Posted by mark Bannister on 01/18/07 21:47
lister wrote:
> Hi,
>
> I have a situation where I have a large block of HTML code that is
> conditionally displayed. In effect I have:
>
> html page
> some html
>
> <?php
> if (bShowBlock)
> {
> //LARGE BLOCK OF HTML
> }
> else
> {
> //SOME OTHER LARGE BLOCK OF HTML
> }
>
> some more html
>
> What is the quickest and easiest way to do this? Echoing is not an
> option as I would have to escape eveything in the HTML blocks.
>
> Thanks,
> Lister
>
If you wish to stay in PHP:
echo <<<endofecho
//LARGE BLOCK OF HTML
//does not have to be escaped
// and php vars work
endofecho;
The endofecho must appear on a line by itself without any whitespace and
is case sensitve. It can be hard to debug an error if you have a typo
in the end marker.
Mark B.
Navigation:
[Reply to this message]
|