Forum Moderators: coopster
$Path = "/where/the/files/are";
$PageID = $_GET["pageid"];
//catch urls without a pageid.
if(! $PageID)
include("$Path/Default_Page.html");
//brackets needed as . can be used in variable names.
$filename = "$Path/Page_${PageID}.html";
//check for missing pages
if (! file_exists($filename))
include("$Path/Missing_Page.html");
//everything ok so get the page.
include($filename);
the first code is easy to understand and I am going to to try it...
$pageid = $_GET['pageid']if (!empty($pageid))
{
switch ($pageid)
{
case 1:
@include('pageone.php');
break;case 2:
@include('pagetwo.php');
break
}
}
so.... if I did that how would I set the main include() that loads when the page is first opened?
electrocean
What kind of parse error was it? It always helps to give that kind of information when you want help. Errors are not always reported on exactly the line where they occur. If it says:
Parse error: parse error, unexpected T_IF in...
...it's probably that the line above is missing its ending semicolin.
I hope this helps.