that really depends on the results you are trying to achieve. I tend to leave 
most of the head stuff in plain HTML in an include file - then include() it in 
the PHP page

After that, I try to group my PHP code together as much as possible - which in 
turn, groups the HTML together as much as possible. I hate bouncing in and out 
of <?php ?> just to get some HTML to output.

If I'm in the middle of a PHP block, I tend to "echo" any minor chunks of HTML 
(like </td><td>, or <ul><li> tags) I need to achieve the formatting I am after 
- it's easier for me when I am debugging or changing something later on.

Keep the code as readable as possible so when you, or someone else, needs to 
change it in the future, you can figure out what you were doing in the first 
place. Most code is easily deciphered by whomever wrote it (unless of course 
it's C++, lol) but write code knowing you or someone else may have to work, or 
re-work it 10 years from now.



----- Original Message ----- 
  From: Patrick Newberry 
  To: [email protected] 
  Sent: Wednesday, January 10, 2007 7:11 AM
  Subject: [php_mysql] html tags when and why


  I've noticed when building a page, such as "hello world"

  You don't put any html tags, just echo "hello world"

  But looking at other programs I sometime see echo / prints of all htlm
  tags such as:

  echo "<html>";
  echo "<header>";
  echo "</header";
  echo "<body>";

  well you get the point.

  Since both seem to work, what html tags should you output and when is it
  ok to not bother or does it matter?

  Pat
  www.gypsyfarm.com



  [Non-text portions of this message have been removed]



   

[Non-text portions of this message have been removed]

Reply via email to