When a url uses a link like what your after, the main file is not called guide.php, its actually index.php
Because index.htm, index.html, index.php etc are default pages when a web page opens, it looks for these files first.
So if you have an index.php in a "myDirectory" folder, then you dont actually need to type /index.php
Example:
Code: Select all
http://mywebsite.com/myDirectory/index.php
http://mywebsite.com/myDirectory/
These two links are the same page (assuming you dont have anything other than index.php in the folder that could override it)
So when you want a link like this:
Code: Select all
http://mywebsite.com/myDirectory/?page=guide
Actually refers to the link:
Code: Select all
http://mywebsite.com/myDirectory/index.php?page=guide
To get the page value from the index.php file, you would need something like this:
Code: Select all
<?php
if(!isset($_GET['page']){
$page = "index"; // if there is no page specified, use the default page
}else{
$page = $_GET['page']; // if there is a page specified by $_GET, use it instead.
}
/*
* This is where you can now call each page as you need it.
* There are many ways in which you can do this, but if you
* wanted to INCLUDE a file 'guide.php' when the page specified
* is 'guide', then you would use something like this.
*/
if($page == "guide"){
include_once("guide.php");
}elseif($page == "info"){
include_once("info.php");
}else{
include_once("index.php"); // the index page is only shown if no other pages are specified.
}
?>
Hope that clears up a few things
