Publishing System Settings Logout Login Register
PHP Navigation Tutorial
TutorialCommentsThe AuthorReport Tutorial
Tutorial Avatar
Rating
Add to Favorites
Posted on February 12th, 2008
13079 views
PHP Coding
On your index.php where the content is meant to go put this:

<?php
if(isset($_GET['page']) && isset($_GET['id']) && file_exists('modules/'.$_GET[id].'/'.$_GET[page].'.php')) //if the GET variable page and id is set and they exist in a folder with the same name as the id and a file with the same name as the GET page variable.
{
include 'modules/'.$_GET[id].'/'.$_GET[page].'.php';//we include it
}
else //otherwise we
{
echo "INDEX CONTENT"; //echo the content for the index page
}
?>


now that we have that done we create a folder called: Modules

In this folder we create folders. So say we created a folder name "News" the $_GET['id'] would be news and inside that folder we create a page called for instance news.php then the $_GET['page'] would be news. Now to get to that page we would go to:

www.mydomain.com/index.php?id=news&page=news

Now to shorten this and make it search engine friendly we are going to create a .htaccess file and use mod rewrite.

So create a file named: .htaccess

RewriteEngine on
RewriteRule ^news(/?)$ /index.php?id=news&page=news


That simply tells the server to show on the page id=news&page=news it can be accessed via (/news). Yes i know its kind of confusing and i will get more into .htaccess on my .htaccess tutorial i hope to make soon.
Anyway now we have turned this:

www.mydomain.com/index.php?id=news&page=news

into:

www.mydomain.com/news


And thats it. I hope you understand me. Please PM me or E-Mail me ([email protected]) with any problems.
Dig this tutorial?
Thank the author by sending him a few P2L credits!

Send
GTMedia

Hey Im a young webdeveloper from scotland. If you want to know more about me. Visit www.mark-cole.net :)
View Full Profile Add as Friend Send PM
Pixel2Life Home Advanced Search Search Tutorial Index Publish Tutorials Community Forums Web Hosting P2L On Facebook P2L On Twitter P2L Feeds Tutorial Index Publish Tutorials Community Forums Web Hosting P2L On Facebook P2L On Twitter P2L Feeds Pixel2life Homepage Submit a Tutorial Publish a Tutorial Join our Forums P2L Marketplace Advertise on P2L P2L Website Hosting Help and FAQ Topsites Link Exchange P2L RSS Feeds P2L Sitemap Contact Us Privacy Statement Legal P2L Facebook Fanpage Follow us on Twitter P2L Studios Portal P2L Website Hosting Back to Top