Php simple navigation same as vb

Status
Not open for further replies.

krates

Be CoOl rAp RuLeZ !!!
Html pages are boring. Everyone is using php navigations now, for example ?id=news etc., well its not all that complicated and since you are reading this I assume you would like to learn how to do it!


Note:

Your server must have php installed for this to work and your extensions should end in .php.
And on to the tutorial:
This is the basic code I use, you can copy it and put it on your page!


Note
This code would go in your main content area.


<?php
switch($id) {
default:
include(’news.php’);
break;
case ‘about’ :
include(’about.html’);
break;
}
?>


Thats it, however i will explain it in a bit more depth..


default:
include(’news.php’);
break;


This is the main page you want to open when you load your website for most people its news and updates etc. This can be php or html or whatever.


case ‘about’ :
include(’about.html’);
break;


This is the page you want to include next such as an about page etc. Keep adding the pages so you got all you need. Your code will look like something below:


<?php
switch($id) {
default:
include(’news.php’);
break;
case ‘about’ :
include(’about.html’);
break;
case ‘tutorials’ :
include(’tutorials.php’);
break;
case ‘downloads’ :
include(’downloads.html’);
break;
case ‘templates’ :
include(’temps.html’);
break;
case ‘comming’ :
include(’soon.html’);
break;
}
?>


Now if you are not completely lost yet this is what you do to link your pages, Change your links from



<a href=”about.html” mce_href=”about.html”>About</a> to <a href=”?id=about” mce_href=”?id=about”>About</a>



if you like this please comment on my blog post
 
Status
Not open for further replies.
Top Bottom