<<< EOPAGE html formatting in PHP?

Ask a Question related to Dreamweaver AppDev, Design and Development.

  1. #1

    Default <<< EOPAGE html formatting in PHP?

    I am running PHP 4.3.10.10, WinXP/IIS and I have been using some code examples
    from the book, 'PHP/mySQL Bible'. There is an example where they use the
    following script to format/render the html. This eliminates having to use the
    echo or print statement: <?php // Now lay out the page //
    -------------------- $page_str = <<< EOPAGE <html> <head> <title>PHP</title>
    </head> <body> <div align='center'> <!-- place a variable in the query string
    'bub=variableName' --> Test the code for $_GET[bub] </div> </body> </html>
    EOPAGE; echo $page_str; ?> Evidently '$page_str = <<< EOPAGE' in conjuntion
    with 'EOPAGE;' and 'echo $page_str;' eliminate the need for an echo statement.
    All I know is that it works. Can anyone elaborate on this? Any feedback is
    greatly appreciated.

    jip Guest

  2. Similar Questions and Discussions

    1. html formatting within List Component
      Hello. Due to drive failures, the source file for a little video viewer flash movie has been lost. it consists of a list component with the videos...
    2. adding HTML formatting to a datagrid
      Hello, I have a datagrid in an .aspx page that I'd like to add some HTML formatting to: <asp:BoundColumn DataField="Pict1"...
    3. keeping html formatting in text
      Hi I've got some text coming out of a database, but html markup isn't being turned into formatting. For example, the text in the database is: ...
    4. html formatting in flash
      I have an textfield set to display html. When I include two hyperlinks with a space between, Flash is ignoring the space and placing the hyperlinks...
    5. formatting ruby code in html
      Is there a similar function in Ruby to the highlight_file function of php...this function takes a file and outputs it in html.... ...
  3. #2

    Default Re: <<< EOPAGE html formatting in PHP?


    "jip" <chris.manning@eds.com> wrote in message
    news:d2ham5$b9e$1@forums.macromedia.com...
    >I am running PHP 4.3.10.10, WinXP/IIS and I have been using some code
    >examples
    > from the book, 'PHP/mySQL Bible'. There is an example where they use the
    > following script to format/render the html. This eliminates having to use
    > the
    > echo or print statement: <?php // Now lay out the page //
    > -------------------- $page_str = <<< EOPAGE <html> <head> <title>PHP</title>
    > </head> <body> <div align='center'> <!-- place a variable in the query
    > string
    > 'bub=variableName' --> Test the code for $_GET[bub] </div> </body> </html>
    > EOPAGE; echo $page_str; ?> Evidently '$page_str = <<< EOPAGE' in
    > conjuntion
    > with 'EOPAGE;' and 'echo $page_str;' eliminate the need for an echo
    > statement.
    > All I know is that it works. Can anyone elaborate on this? Any feedback is
    > greatly appreciated.
    >
    Check out heredoc syntax in the php documentation.

    < [url]http://www.php.net/docs.php[/url] >

    HTH

    -Rb

    -Rb Guest

  4. #3

    Default Re: <<< EOPAGE html formatting in PHP?

    On Thu 31 Mar 2005 12:06:13p, jip wrote in macromedia.dreamweaver.appdev:
    > 'echo $page_str;' eliminate the need for an echo statement.
    > All I know is that it works. Can anyone elaborate on this?
    Well, you are using an echo statement; you're just using a single echo
    to output a whole long string.

    The syntax you're seeing:

    $page_str = <<< EOPAGE
    ....
    EOPAGE;

    is known as 'heredoc':

    [url]http://us4.php.net/manual/en/language.types.string.php#language.types.string.sy ntax.heredoc[/url]
    Joe Makowiec Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139