Reply to Re: opinions on inline server-side code?

Your name:

Reply:


Posted by Jim Higson on 02/26/06 20:31

John Salerno wrote:

> After doing a little reading (I'm trying to figure out how to in-line
> Python code in my HTML), it seems like a lot of purists think that
> inline code is a bad thing (sort of like inline style). I was wondering
> what you guys think of that, since you are obviously very strict about
> things like style, HTML vs XHTML, etc. (although, I've never heard any
> criticism in this group of inline PHP, for example, such as when I asked
> about it a while back).

Personally, I find the "PHP in HTML" and "HTML in PHP" models pretty messy
except for adding little bits of dynamic content to the pages.

PHP in HTML: all the <?php and ?> tags ruin the flow of the HTML and make it
difficult to read. Difficult to use for large projects, where much of the
code doesn't belong in any particular place in the HTML.

HTML printed from PHP: Discourages Indentation on the HTML so it is hard to
see at a glance which echo "<div>"; corresponds to which echo "</div>".

My preferred way is to use PHP for the SQL plus a templating engine for the
HTML (ironic since PHP was originally just a templating engine). My
preferred engine is Smarty:

http://smarty.php.net/

--
Jim

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация