Re: Website templating schemes
| From: | CPT John W. Holmes | Date: | Tue, 26 Aug 2003 16:59:13 +0000 |
| Subject: | Re: Website templating schemes | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-160811@lists.php.net to get a copy of this message | ||
From: "Joel Konkle-Parker" <jjk3@msstate.edu>
> I'm trying to make a PHP-backed website, and I'm trying to decide between
two
> templating schemes:
>
> 1. define 2 php template files: header.php, footer.php. in index.php,
require
> header.php, output content, require footer.php
>
> 2. define a php template file and a local page file. index.php defines
body()
> and crequires template.php. template.php prints the header, calls body()
to
> print the content, and and prints the footer.
>
> I'm currently using the second method, but I've only seen the first used
> elsewhere. Is there a reason that #1 is better than #2 (or is anything
else even
> better than that?)?
With method 2 it seems like your template file would become redundant
because every one of them would have to contain the header and footer code.
I would use 3 template files, header.php, footer.php, and body_index.php
index.php would:
1. PERFORM LOGIC
2. include header
3. include body
4. include footer
Then, all you have to do is make new body_XXX.php files for each page on
your site and the header/footer content is contained in one place.
---John Holmes...