Page 1 of 1

template question (or is it)

Posted: Sat Jun 28, 2003 1:23 am
by griz
I'm just starting php with this site:

http://www.3dmaniac.com/index2.php?file=members.php

As you may notice the url isn't set up good because if I needed to add another question mark after home.php I was told it can't be done. I would like to setup a system so that you would have to go to this url instead of above.

http://www.3dmaniac.com/members

Each section of this site has is included through:

<?
$docroot = getenv("DOCUMENT_ROOT");
$pathfilename = $docroot . "/" . $file;
?>

then inserted in by: <? include($pathfilename); ?>

I could go about this by making a separate template index2.php for every page. But that would be tedious. I know there is a better way because a ton of sites have it set up this way.

An example:
http://www.flashkit.com/tutorials/

I'm not asking for something to walk me through the whole thing, (all though it would be nice :D ), but for someone to just point me in the right direction.

Thanks

Posted: Sat Jun 28, 2003 4:00 am
by qartis
Flashkit.com has two ways of doing that:

a) The 'tutorials' section is actually /tutorials/index.php , which is the most common way.

b) Their apache setup has mod_rewrite and mod_proxy, and they have a rewrite rule to catch /template/, and rewrite the URL string accordingly.

Posted: Sat Jun 28, 2003 11:12 am
by griz
But about this.

http://www.phpfreaks.com/tutorials/71/0.php

how do they get the footer, header, and menu attached to the each and every page. I know they are using the inlcude function, but there must be something else. If they were just using the include they would have to make a separate template for 0.php, 1.php, 2.php, 3.php. Or maybe not.

So my question is, how do you get everpage to look the same through directories with using ONE TEMPLATE file.