mxdan Posted February 19, 2007 Share Posted February 19, 2007 <?php $folder = "content/"; //folder to look for the html files in include("top.html"); //include the top $page = $_GET['page']; // set ?page= to $page $page = preg_replace("[^A-Za-z0-9\_\-\.]", "", $page); //replace anything thats not alphanumeric, -,_, or . with blankness if(file_exists($folder . $page . ".html")) { //if the file exists include($folder . $page . ".html"); //include the file } else { echo "Page Not Found"; //if it doesnt exist } include("bottom.html"); //include the bottom ?> Particularly the part that determines what content page will show... Quote Link to comment Share on other sites More sharing options...
Wildhalf Posted February 19, 2007 Share Posted February 19, 2007 What are you trying to do?? Quote Link to comment Share on other sites More sharing options...
mxdan Posted February 19, 2007 Author Share Posted February 19, 2007 To make it so I have a top.html and bottom.html. Which makes my layout and in between my content pages go. Quote Link to comment Share on other sites More sharing options...
Wildhalf Posted February 19, 2007 Share Posted February 19, 2007 I understand what you are doing but think you making it hard on yourself why not just do the following Create a PHP file for each page using the code below just changing the content.html page to the cotent you want for each link...... eg. Index - content_index.html contact - content_contact.html and so on why make things hard <?php include "top.html"; include "content.html"; include "bottom.html"; ?> Quote Link to comment Share on other sites More sharing options...
marcus Posted February 19, 2007 Share Posted February 19, 2007 Why not check if your page is alphanumeric instead of replacing it. if(!ctype_alnum($page)){ include('index.html'); }else { if(file_exists($page)){ include("whatever"); }else { include('index.html'); } } Quote Link to comment 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.