o0slowpaul0o
New Member
- Messages
- 254
- Reaction score
- 0
- Points
- 0
Have you seen the URL where they say index.php?content=home and where the index page stays and the content change, here is a small tutorial where I will explain this.
In the index.php file, you shall add this code before the <html> tags:
In the first 2 lines is will make a variable where it will set the $content variable to what the content is in the URL. If you have an URL like this "index.php?content=aboutus" it will set the content variable to aboutus.
In the line 3 to 6, it sets the variable to home if the content variable is not set. Those lines are very important because if you come into the site for you first visit the content variable is not set, so if you do not have these lines you will get an error message.
Where you what the content to be include you insert this code.
When you now link to your page you shall use this link:
The link above will link to a page called aboutus.php.
In the index.php file, you shall add this code before the <html> tags:
Code:
<?php
$content = $_GET['content'];
if($content == "") {
$content = "home";
}
?>
In the first 2 lines is will make a variable where it will set the $content variable to what the content is in the URL. If you have an URL like this "index.php?content=aboutus" it will set the content variable to aboutus.
In the line 3 to 6, it sets the variable to home if the content variable is not set. Those lines are very important because if you come into the site for you first visit the content variable is not set, so if you do not have these lines you will get an error message.
Where you what the content to be include you insert this code.
Code:
<? php
include("$content.php");
?>
When you now link to your page you shall use this link:
Code:
index.php?content=aboutus
The link above will link to a page called aboutus.php.