Spitfire Posted March 14, 2008 Share Posted March 14, 2008 I have a site running this code: HEADER // Content Loaded Here <?php $pathToMainPage = "news/news.php"; $pathTo404Page = "error.php"; if(isset($_GET['page'])) { $pathToIncludePage = $_GET['page'].=".php"; if(file_exists($pathToIncludePage)) { include $pathToIncludePage; } else { include $pathTo404Page; } } else { include $pathToMainPage; } ?> // End Content FOOTER This outputs all pages as index.php?page=PageName. My question is whats the easist way to make a template that will allow pages to be displayed like this. domain.com/category1/page1/ using a common header / footer etc. atm i have domain.com/index.php?page=category1/page1 any help would be great, thanks! Quote Link to comment https://forums.phpfreaks.com/topic/96145-php-include-site-template/ Share on other sites More sharing options...
Guest elthomo Posted March 14, 2008 Share Posted March 14, 2008 I'm a php learner so this may not be correct but...... Could you not put an include with the header(html banner and stuff) above where the content starts and the same for the footer but below on each page you call ? Quote Link to comment https://forums.phpfreaks.com/topic/96145-php-include-site-template/#findComment-492166 Share on other sites More sharing options...
samshel Posted March 14, 2008 Share Posted March 14, 2008 Hi, Please check rewrite rules and .htaccess changes on google. It will be easy with one rule like below ([^/]*)/([^/]*)/ index.php?page=($1)/($2) To use .htaccess, you should have allowoverrideall setting enabled in httpd.conf. Please google around. hth Quote Link to comment https://forums.phpfreaks.com/topic/96145-php-include-site-template/#findComment-492180 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.