navigation help (php)

nexhunter

New Member
Messages
239
Reaction score
1
Points
0
http://forumnerds.com/showthread.php?p=6

k im using that tutorial and it is working but does anyone know what i have to do so the script looks into a subdirectory for the files instead of where the index file is.

PHP:
<?php
if(!isset($_GET['id'])) {
include "id/main.php";
}elseif(!file_exists($_GET['id'].".php")) { // this also takes you to the home page if the page you're looking for using the ?page= dosn't exist
include "id/error.php"; 
}else{ //if all goes well
include $_GET['id'].".php"; // include the page e.g if it was ?page=tutorials include tutorials.php
}
?>

thks for the help.

*i've edited only where the main page and error is and the [id] so it uses id not page for the linking
 

coolv1994

Member
Messages
508
Reaction score
0
Points
16
I would reccommend using this script its alot eaiser.
PHP:
<?php
if ($_GET['id'])
if (file_exists('./'.$_GET['id'].'.php'))
@include($_GET['id'].'.php');
else
@include('./error.php');
else
@include ("./main.php");
?>
Just name your files what ever you want the ?id= to be.
PM if you need any help.
 
Last edited:
Top