Log in

View Full Version : Webpage Template in a Single file?


BrewKnowC
02-12-2004, 10:52 AM
Hi, I'm not a web designer so I don't know all the little web tricks out there, but is there a way so that I can have my whole page layout (with sidebar, menus and links) in one file, then each real web page just acts like content to that file? (without using frames) Can you use a .css to do this? I ask this because when I want to make a minor menu change I currently have to change it in every one of my pages.

Thanks

Lizardsoft
02-12-2004, 12:08 PM
Assuming your web server has PHP support, you can name your files with a .php extension and do something like:

In index.php or game.php or whatever your content file is:

<? include( './includes/top.inc.php' ); ?>
<? include( './includes/leftnav.inc.php' ); ?>
<p>Hello this is some content</p>
<? include( './includes/right.inc.php' ); ?>
<? include( './includes/bottom.inc.php' ); ?>


All those included files just include other parts of your site. For example leftnav.inc.php could have all the HTML for your navigation bar.

http://www.php.net for info on PHP.

Tom Cain
02-12-2004, 12:08 PM
Hi Bruno,

There are several ways to do this. I assume you are looking for a simple method, so here is a simple step-by-step tutorial for doing what you are describing in PHP:

http://codewalkers.com/tutorials.php?show=58

-Tom

BrewKnowC
02-12-2004, 01:07 PM
Thanks guys, this looks great! As soon as I get time I'll convert my whole site to this system. Thanks again! :)