You are here: Re: Using the same template for each page « PHP Programming Language « IT news, forums, messages
Re: Using the same template for each page

Posted by Christopher Pomasl on 08/30/05 01:09

On Mon, 29 Aug 2005 06:01:01 -0700, J Smith wrote:

> I'm making a website where each page has the same design, obviously its
> a bad idea to put the same code/html in each page so what is the best
> way to do this?
>
<snip>

I do the following:
I have Menu.php and Trailer.php in the "components" directory.
Each page then does:
include (components/Menu.php)
content
include (components/Trailer.php)

Menu.php includes the standard header and a menu bar but also includes a
sidebar which (someday) will contain content from our calendar. From here
you can also add whatever code that needs to be executed for every page.
I use this for login and session handling, personalizing the header for
the logged in user, etc.

Since we have the sidebar, the Menu.php ends with a table. The first
column in the table is the sidebar and the <TD> for the second column (the
content) is written.

The content then displays from the page issuing the include(Menu).

The Trailer.php script then closes the </TD> and writes out the footer for
the page.

This keeps the standard stuff in singular places and the content whereever
it needs to be.

Chris

 

Navigation:

[Reply to this 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

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