Re: if... then... else with HTML

From: Date: Mon, 23 Apr 2001 15:39:11 +0000
Subject: Re: if... then... else with HTML
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-49871@lists.php.net to get a copy of this message
Alternatively, and this is what I would do because it would be easier to maintain should you want to change the content later on, you could use includes as per the following: <?php print("<html>\n<head>\n<title>Try This</title>\n</head>\n<body>\n"); if(condition) include("html_block_1.html"); else include("html_block_2.html"); print("</body>\n</html>"); ?> I suppose it would depend on how big your HTML blocks are. Either way -- using includes or using the method below -- will work, and with neither method will you have to escape out your special characters. >>>>>>>>>>>>>>>>>> Original Message >>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<< On 4/23/01, 3:59:41 PM, "elias" <elias_bachaalany@yahoo.com> wrote regarding Re: [PHP] if... then... else with HTML: > yes, consider this: > <html> > <body> > <? if (isset($name)) { ?> > your name is <?=$name?> > <? } else { ?> > <h1>name is not set!</h1> > <? } ?> > </body> > </html> > -elias > http://eassoft.cjb.net > "Martin Thoma" <martin@radiok2r.de> wrote in message > news:3AE422E4.742FB756@radiok2r.de... > > Hello ! > > > > I want to do something like > > > > if (condition) > > output this html-block > > else > > output that html-block > > > > > > Without printig or echoing the html-block out (because the block has a > > lot of ", which I all would have to slash out...) > > > > How can I do that ? > > > > Martin > > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > > For additional commands, e-mail: php-general-help@lists.php.net > > To contact the list administrators, e-mail: php-list-admin@lists.php..net > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#49871) next »