|
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]
|