note 38084 deleted from language.basic-syntax by sobak

From: Date: Tue, 22 Nov 2016 08:21:13 +0000
Subject: note 38084 deleted from language.basic-syntax by sobak
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-207475@lists.php.net to get a copy of this message
Note Submitter: johnbeech at (not saying) mkv25 dot net ---- In the note above about escaping XML/PHP style <?xml tags, the following code was used: <?php // Html safe containers echo <<<EOD <?xml version="1.0"?> ...all sorts of XML goes here... Nothing will affect the output of this code until: EOD; ?> EOD is just an example stop/start name. This works too: <?php // Html safe containers $myOutput = <<<MYHTMLSAFEOUTPUT <?xml version="1.0"?> <html> <title>PHP Example</title> <body> <p>...all sorts goes here...</p> </body> </html> MYHTMLSAFEOUTPUT; echo $myOutput; ?> Only disadvantage of using this is that all the code highlighting programs I've seen never get it right, making your code look eronous in the majority of viewers. Another alternative is to keep the XML / HTML in a separate include file and read in when needed. I don't know how efficient/inefficient this is for small amounts of text. xmlheader.txt: <?xml version="1.0"?> mypage.php: <?php include("xmlheader.txt"); ?>

« previous php.notes (#207475) next »