Forum Moderators: coopster
example one:
<div class="newsRelease">
<?php
$file="news/nr_" . $_GET[nrDate] . ".xml";
$xml = simplexml_load_file($file) or die ("Unable to load " . $file);
?>
<div class="nrDate"> <?php echo ($xml->nrDate);?> </div>
<div class="nrTitle"> <?php echo ($xml->nrTitle);?> </div>
<div class="nrBody"> <?php echo ($xml->nrBody);?> </div>
</div>
as compared to example two:
echo '<div class="newsRelease">';
$file="news/nr_" . $_GET[nrDate] . ".xml";
$xml = simplexml_load_file($file) or die ("Unable to load " . $file);
echo '<div class="nrDate">' . ($xml->nrDate) . '</div>';
echo '<div class="nrTitle">' . ($xml->nrTitle) . '</div>';
echo '<div class="nrBody">' . ($xml->nrBody) . '</div>\n</div>';
thanks & take care!
j.
If you're using PHP to echo HTML, there's a miniscule overhead because the code is being parsed by the PHP preprocessor. However, there's also a small overhead for swapping in and out of PHP parsing! I'd stick with your usual routine unless you were embedding PHP code every few characters in a long section of HTML, where the second option might be more appropriate. The chances of that sort of scenario arising are pretty slim though.