I want to create a big string in PHP and eventually print it. The string has to print like a hole page of text with colors, line breaks and alignments. Does anyone know where i could find the tags for all of these : colors, line breaks and alignments.

Thank you very much

    Hi. Are you looking for html or how to create and echo a PHP string?

      a echo php string.

      But i want it to include alignements, line feeds, bold text, color text....

        Hi. From php.net, one way to do that is as follows...

        $foo = <<<END
        This uses the "here document" syntax to output
        multiple lines with $variable interpolation. Note
        that the here document terminator must appear on
        a line with just a semicolon no extra whitespace!
        END;
        
        echo $foo;
        

        Cheers.

          $stringtoprint = "<b>Bold</b> or <i>italic</i>, or with <font color = \"red\">fontcolor</font> etc...";

          echo $stringtoprint;

          or you can do all of that in regular html inside the php script, that is the beauty of php, hopping in and out of php mode without it causing ANY strain on the server whatsoever...

            Originally posted by zmola

            I have been testing heredoc string on my server over and over and keep getting blank pages. The follow code even gave me a blank page. Could this be caused by the way my php 4.3.2 is set up?

            $foo = <<<END
            This uses the "here document" syntax to output
            multiple lines with $variable interpolation. Note
            that the here document terminator must appear on
            a line with just a semicolon no extra whitespace!
            END;
            
            echo $foo;
            

              this works

              <?
              echo <<<END
              This uses the "here document" syntax to output
              multiple lines with $variable interpolation. Note
              that the here document terminator must appear on a
              line with just a semicolon no extra whitespace!
              END;
              ?>

                I get a blank page with the following code:

                <? 
                echo_<<<END 
                This_uses_the_"here_document"_syntax_to_output 
                multiple_lines_with_$variable_interpolation._Note 
                that_the_here_document_terminator_must_appear_on_a 
                line_with_just_a_semicolon_no_extra_whitespace! 
                END; 
                ?>

                this is driving me nuts, is becasue I'm on OS X, or my php version (4.3.2).

                  Strange? whn I copied my code over it put in "_" underscores between the words?

                    Originally posted by shoshumi
                    Strange? whn I copied my code over it put in "_" underscores between the words?

                    it does that every now and then

                      Originally posted by stolzyboy
                      try going here and tell me what you get

                      I get:

                      "This uses the "here document" syntax to output multiple lines with interpolation. Note that the here document terminator must appear on a line with just a semicolon no extra whitespace!"

                      which is correct. But heredoc doesnot work on my machine. Myabe becasue I'm writing code with OSX/ Dreamweaver?

                        not too sure, my site is hosted on RH linux, and php 4.3.2, and i just tested that same code on my windows box with php 4.3.2, and my os x box with 4.3.2, and they all work just fine

                          Strange... well I'll keep trying. If i find a solution I will post it here.

                          thanks a bunch for your help

                            Just a note...

                            Along with making sure that the here document terminator (ENDπŸ˜‰ appears on a line with no extra whitespace, try making sure that the here document starter ($foo = <<<END) also appears on a line with no extra whitespace.

                              thanks again,

                              no such luck though. I've tested other scripts and they work but heredoc strings just give me blank pages. tried removing whitespace many different ways and writing code in different editors still no luck. I'm looking at the php.ini file to see if something is off or wrong.

                              keep you posted

                                I got it too work!

                                I restarted my apache server, then I tried starting from a fresh page. It seems not to work if you copy and paste code from this forum, it will not work even when you remove whitespaces.

                                Write it out yourself and it works..hmmm

                                  Hi. Just curious... did you originally copy-paste straight to a text only editor?