sp0rk Posted February 2, 2003 Share Posted February 2, 2003 I was wondering how you make a page that uses a template. Basically, i want a template page and then i make all the links like http://sp0rk-tech.net/index.php?section=downloads So it would only be using on template page, and including the downloads page within the page. *I DONT WANT I-FRAMES* Thanks in advance to anyone that helps! :D Link to comment Share on other sites More sharing options...
0 Ricky Baby Posted February 2, 2003 Share Posted February 2, 2003 where you want to put the page use include("$section.inc"); HEADER <?php include("$section.inc"); ?> FOOTER you can also use include("path/to/$section.inc"); Link to comment Share on other sites More sharing options...
0 Zero1 Posted February 2, 2003 Share Posted February 2, 2003 I believe this is what you are looking for: Make the template page, with all the links, etc in it that you want, and put this php script where you want the content of each page to be shown: Simple Version <? $section = $HTTP_GET_VARS['section']; if ($section == "") $go = "default"; if (!file_exists("$section.php")) $go = "error"; include("$section.php"); ?> Each include is the name + the php extension. default would be default.php, etc etc. This script is useful, however not so secure. I reccomend this one, which is a little more advanced, but should keep most of the script kiddies out Longer Version <? $section = $HTTP_GET_VARS['section']; $section = ereg_replace('<([^>]|\n)*>', 'default', $section); $section = ereg_replace('[.]', ' ', $section); $section = ereg_replace('/', ' ', $section); $section = ereg_replace('<script>','default', $section); $section = ereg_replace('index','default', $section); if ($section == "") $section = "headlines"; if (!file_exists("$section.php")) $section = "error"; include("$section.php"); ?> ereg_replace replaces the first value with the second value. Link to comment Share on other sites More sharing options...
Question
sp0rk
I was wondering how you make a page that uses a template. Basically, i want a template page and then i make all the links like http://sp0rk-tech.net/index.php?section=downloads
So it would only be using on template page, and including the downloads page within the page.
*I DONT WANT I-FRAMES*
Thanks in advance to anyone that helps! :D
Link to comment
Share on other sites
2 answers to this question
Recommended Posts