PDA

View Full Version : PHP Navigation Tutorial



DanWilliamson
12-01-2006, 08:49 PM
Hey,

I've written a tutorial on a basic navigation in PHP which could be useful.

Well first before we even begin trying, make sure your host is PHP supported, so don't try this with Freewebs.

Also don't forget to save the index as .php

First we open the PHP tag


<?php

?>

Then we add our switch variable which is pretty much self-explanitory.


switch($id) {

Now if your new too PHP you can always tell a variable by the American Dollar sign $ Now we're ready too make the actually links.


default:
include('url.php');

Now obviously you change the URL in the link too the URL you want it too display.

Now for the ID of the page.


break; case "The Page ID":

I'm guessing that this has already been explaned, you just change the ID of the pages.

Now too actually include the pages.


include('page1.html');

Now the code all together.


<?php
switch($id) {
default:
include('url.php');
break; case "The Page ID":
include('The ID.php');
}
?>

Now your links are going too have that cool look that all the big sites have :P

page.php?id=ID

Hope this helps, now for advanced PHP coders there are more and better ways too do this, but this is a very simple yet effective way.

- Dan

ADAM:
12-01-2006, 09:44 PM
Parts of that help me out with php

Thanks Dan :) +Rep

DanWilliamson
12-01-2006, 09:45 PM
Hey,

No problem. And if you have any other questions too do with PHP, or any other language I will try and help you out to the best of my ability.

- Dan

Php
12-01-2006, 10:18 PM
cool nice mini tut +REP

DanWilliamson
12-01-2006, 10:19 PM
Hey,

Thanks dude. Just trying too help people, and also thanks for the rep.

- Dan

Want to hide these adverts? Register an account for free!