FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Embedding HTML Within a PHP Statement
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Embedding HTML Within a PHP Statement [message #176008 is a reply to message #175980] Tue, 15 November 2011 02:15 Go to previous message
bobmct is currently offline  bobmct
Messages: 16
Registered: September 2010
Karma:
Junior Member
FWIW - I have to read and maintain lots of php code written by others
all day long. In my learned experience the drop in / drop out of php
again and again is a real pain on the eyes.

My preference is to output entire blocks of html code using heredocs
so the program actually never drops out of php.

Something like this snippet:

<?php
..
..
..
//*************************************************************************
// Default 'unknown' content
else {
$_HeadWords = "Uh Oh!";
$_Image = "pix/UhOh.jpg";
$_Verbiage = "Content Indicator ($func) UNDEFINED!.";
}
//*************************************************************************
// Now print the column
print <<<EOD
<div id="left-column"><!-- Begin left-column area -->
<img class="image-left" src="$_Image" height="189" width="299"
alt="$_Alt" />
<div style="margin: 10px 10px 10px 10px;"><!-- Begin inline style area
-->
<h3>$_HeadWords</h3>
<p class="align-left">$_Verbiage</p>
</div><!-- End inline style area -->
</div><!-- End left-column area -->
<div id="right-column"><!-- Begin of right-column area -->
EOD;
}
// End of _LeftColumn function
//************************************************************************* *****
..
..
..
?>

Preferences vary by individual. But something like the above will
help the "next" guy who has to work with the code.

Bob
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Smart File Downloader - simple script on xampp
Next Topic: Prevent unlink(...) warning
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 10 15:57:46 GMT 2024

Total time taken to generate the page: 0.04237 seconds