Reply to Re: Best way to conditionally show large blocks of HTML

Your name:

Reply:


Posted by Erwin Moller on 01/18/07 10:38

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

Hi Lister,

Just jump out of PHP, like this:

<?php
if (bShowBlock) {
?>
Use plain html here
<?php
} else {
?>
Use plain html here
<?php
}
?>

Alternatively you can include a file that contains the large piece of html,
in which case you just use something like :
require 'myLargeHTML1.html';


Regards,
Erwin Moller

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация