Jump to content

How to use this code >>>


mxdan

Recommended Posts

<?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...

Link to comment
Share on other sites

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"; 
?>

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.