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
> }
>?>
>
>Your header and footer are now in one "template-like" file which makes
>it easy to match up tags.
>
>-snip-
>
>The reason I prefer this to header/footer includes, is that it's too
>easy to mess up closing tags in footer/header out of sync with
>separate files, but with one file, they're right there and a decent
>HTML editor will pick them out for you.
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.
I usually start my pages off with:
<?php include('includes/header.inc'); ?>
and end them with:
<?php include('includes/footer.inc'); ?>
Inside the header, I have the DOCTYPE, <html>, <head> (with all the header
stuff including css) and <body> tags.
The footer has my closing "Last Modified", Copyright, and the ending </body>
and </html> tags.
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.
I also use other includes, like for navigation. However, every include file is
complete from its start tag to its finish tag so I never get my tags out of
sync. It's just a matter of good housekeeping.
If I want to control the color of something, then I do it in css. If I have to
do it via php, then I wrap css in php and do it there. But, I always try to
keep presentation out of my code. Besides, I find it's much easier for me that
way because I can do anything to my code and the presentation stays the same --
likewise, I can do anything I want to my css, and my code remains unaffected.
It works for me.
tedd
--
------------------------------------------------------------------------------------
http://sperling.com http://ancientstones.com http://earthstones.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php