You are here: Re: Code Conventions and preferences « PHP Programming Language « IT news, forums, messages
Re: Code Conventions and preferences

Posted by no on 07/17/05 15:58

On Sat, 16 Jul 2005 23:40:55 -0500, julian maisano
<julianmaisanoXYZ@gmail.com> wrote:
>A kind of survey...
>
>1) what do yo prefer?
>
>a)
>echo '<table border="1" width="100%" border="0" cellspacing="0">';
>?>
>
>or
>b)
>?>
></table>
>
>I mean, html inside php block or outside?

I'd say it is all down to which predominates ... some of my pages are
purely HTML so they need no PHP. Others might just need a small bit of
database-derived information or some constants or included blocks etc
so i have the HTML surrounding one or two small <?php ... ?> areas.
But if the page is basically all includes and logic or data-derived
areas then i'd start with a <?php and finish with ?> and then echo
the HTML inside.

Basically, I agree with one of the other posters - avoid jumping in
and out of PHP because it makes the code very hard to follow and debug
later. Also, it's as much as anything down to readability and
presenting an intuitive source-code - so think of the person following
on from you who has to maintain the site - or even yourself a year on.
Put in plenty of comments describing what the script should do over
all - and then in more detail before major sections describing perhaps
why you chose to do the code in such a way.

Chris

 

Navigation:

[Reply to this 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

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