Jump to content

single page with referrer to show correct page


lkbolt

Recommended Posts

I have a simple website with a couple of different pages.  I would like to be able to in a div tag with a php require or even inside the same page be able to show whatever link is clicked on that part of the page is shown.  this is kinda of difficult to explain. What I am trying to do is get  the entire site down to 1 or 2 pages. with all content in the content part of the page being presented by whatever link is clicked.

how do I incorporate my whole site, all my pages home about services contact into one or 2 pages.  I have the front page built I have a content area that I would like to be able to show all pages in it and not a frame maybe have a 2nd page with functions to call each page to the content area and have a php require in the content area.  I just not sure how to do this or where to start I have used php scripts and understand how they work most of the time I am just not sure how to start on this project.

I found what I was looking for here is how I got it done.

I put the following code into the content <div> Tag on my main index.php page where I wanted each page to show its content:

 

<?php $page=array(1=>'page1.php',2=>'page2.php',3=>'page3.php');

 

if(isset($_GET['id'])){

$PageToInclude=(isset($page[$_GET['id']]))?$page[$_GET['id']]:"errorpage.php";

//errorpage.php included if someone messes with the url.

include($PageToInclude);

}

else

{

$homepage='home.php';

include($homepage);

}

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.