Forgot Password / Register
Site Statistics
Total Members: 520
Total Tutorials: 242
Newsest User: 8884244477
Todays Unique Hits: 456
0 Users 5 Guests Online

PHP Navigation

PHP Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
switch($a) { //$page is the url, ie ?page=xxx you can change $page to anything and it will change the URL's {

default: //default page to include
include('main.php');
//other files - rembmer to link your files to whatever.com?page=whatever - try changing $page at the top of the script to nothing, see if that makes it just ?=sdg, otherwise change it to something else, ie $var would make the URL's .php?var=sdg
break; 

case 
"tutorials":
include(
'tutorials.php');
break; 

case 
"contact":
include(
'contact.php');
//add more of these as needed
break; 

case 
"VAR"//VAR is at the end of the url, so if somebody types in ...?=VAR it will include the file mentioned below
include('contact.php');
break;

//End switch
?>


if you want ?a=page&b=anotherpage Just add another switch! like so...

PHP Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php
case "page2":

switch(
$b) {
default:
include(
'page2.php');
break;

case 
"page3":
include(
'page3.php');
break;
}

break;


//I wont explain that because it is the same thing up top
?>
chrism
Author:
Views:
2160
Rating:
Posted on Sunday 1st June 2008 at 03:12 AM
Adam981
Adam981
Sorry for the double post. well i got a different switch PHP Navigation to work, so i'm guessing from looking at the code and what not that this wouldnt work for anyone, seeing that you might need a "GET" function.
Posted on Sunday 1st June 2008 at 02:09 AM
Adam981
Adam981
Wow, i really cant make this work, when i go to link the page

example: "index.php?page=register"
it doesnt change the page and just includes main.php
Posted on Monday 7th April 2008 at 05:33 PM
Dalez
Dalez
Hmm, i did this fine!

But when trying it with rmbs usersystem, when some of the pages use this, its messes up :(

And i dunno how to make it work :P
Posted on Monday 7th April 2008 at 03:14 PM
Dalez
Dalez
Thanks, gonna try now!