Reply to Re: standard coding...

Your name:

Reply:


Posted by Andy Hassall on 01/12/06 03:24

On Thu, 12 Jan 2006 00:10:02 GMT, "Domestos" <never.you@mind.com> wrote:

>i.e. do I make every page a .php page on my website and echo html when I
>need to or...
>
>should I make every page html and embed php when I need to..
>
>for example... which is better or more standard....

It Depends.

Basically on the ratio of PHP versus HTML. For large blocks of HTML with only
small numbers of PHP variables to print, dropping out of PHP mode and into
literal HTML with small <?php echo $x ?> blocks makes sense.

For places where it's predominantly PHP code with a few lines of HTML printed,
e.g. in loops, echo/print makes sense.

Neither's more correct or more standard - it's all down to readability in
context, and personal preference, or coding standards in your organisation if
you're working in a team.

><html>
><head>
><title>title text</title>
></head>
><body>
>You name is <?php $name?>

But this example won't work...

--
Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

[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

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