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