Re: templating

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, June 22, 2006 7:23 pm, tedd wrote:
> At 6:26 PM -0500 6/22/06, Richard Lynch wrote:
>>On Thu, June 22, 2006 6:10 am, Ryan A wrote:
>>> He just needs maybe 5 template
>>> pages, same pages, different color.
>>
>>For something THIS simple, I truly believe you are Better Off (tm)
>>with a simple head() and foot() function in a globals.inc file:
>>
>>function head($title = "My Site", $bgcolor = '#ffffff'){
>>?>
>><!DOCTYPE ...>
>><html>
>>  <head>
>>    <title><?php echo $title?></title>
>>  </head>
>>  <body bgcolor="<?php echo $bgcolor?>">
>><?php
>>  }
>>
>>  function foot(){
>>?>
>>  </body>
>></html>
>><?php
>>  }
>>?>
>>-snip-
>>

> Well... I prefer to separate the header and footer into two files and
> load them as needed in my web page. In addition, I would most
> certainly remove ALL attribute stuff that could/should be controlled
> by css out of html and php and into a css file.

Putting the stuff into CSS is fine with what I did -- I do that all
the time.

> In between the two <body></body> tags it's pretty simple to manage the
> html and keep track of div's. I never have a header or footer that
> goes beyond the body tags -- so even if there is NO html in between, I
> still have a valid page.

The header and footer frequently contain the logo, site nav, possibly
a site-wide context-sensitive nav, maybe a mailing list signup, and
then copyright and so on.

There's no need to be doing a bunch of include files to hit the HD
(expensive) separately for each.

It's also all too easy to forget one of the include files on one of
the pages and never even notice it... I've done it too many times when
I went back to add some fluff page to some ancient site. :-(

A reasonable amount of the "all the same" stuff in head() handles all
that, and the footer, in one HD seek, with matching tags between
head() and foot() in a single file.

It's also very easy to call foot() in an error condition to be sure
all tags balance.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux