Old 11-17-2005   #1 (permalink)
nitr0x.co.uk owner
 
Join Date: Nov 2005
Location: Oxfordshire, UK
Posts: 2

Send a message via AIM to .Silver Send a message via MSN to .Silver
Small PHP Question

Hey, i use a PHP navigation for my web site... the navigation uses ?x=page
and to swap it uses the function of checking to see if ?x= something and it swaps the page that is after the ?x=

So ?x=here

would bring in the content from the page here.php

I was wandering that if you could have a function going like:

if $x = "http://*" { include 'homepage' }

would this work?
__________________
My signatures!
.Silver is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 11-17-2005   #2 (permalink)
dehumanization
Guest
 
Posts: n/a

<?
if (isset($_GET['page']) && isset($_GET['id']) && file_exists('mods/'.$_GET[id].'/'.$_GET[page].'.php')) {
include 'mods/'.$_GET[id].'/'.$_GET[page].'.php';
}
else {
include("directory/to/file.php");


}


?>


if you make a folder called news and a file in the folder called news.php
and send your browers to www.yourdomain.com/?id=news&page=news

it includes news.php automatically. dunno if that helps. just includes the files. make as many directorys as you want and everything.

put your folders for other content inside a folder called 'mods'

works pretty well and i search engine friendly urls i do believe.

so if you had a folder called news and a folder called tutorials, the directory would be mods/news or mods/tutorials.
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 11-17-2005   #3 (permalink)
Sheep Worrier
 
Man1c M0g's Avatar
 
Join Date: Sep 2003
Location: Portsmouth, UK.
Posts: 4,096
Blog Entries: 14

Send a message via ICQ to Man1c M0g Send a message via MSN to Man1c M0g Send a message via Skype™ to Man1c M0g
We have a tutorial on that very same subject over here: http://www.biorust.com/tutorials/detail/57/en/
__________________
Man1c M0g is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 11-17-2005   #4 (permalink)
dehumanization
Guest
 
Posts: n/a

i learned that through a tutorial on www.zulumonkey.org by the way. probably explains it better on there.
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 11-17-2005   #5 (permalink)
nitr0x.co.uk owner
 
Join Date: Nov 2005
Location: Oxfordshire, UK
Posts: 2

Send a message via AIM to .Silver Send a message via MSN to .Silver
Hey... thanks guys... but none of this is exactly what i need... this is the code for swapping pages that I use:

$x = $_GET['x'];
if($x == "") {
$x = "news";
}
include ("$x.php");
?>

I was wandering if it's possible to have an if statement like in the first post so that if it's not on my own server (nitr0x.co.uk) then it just goes to the news page. Is this possible using this method? I need the php navigation like this due to my Tutorial System otherwise it won't work if I put:

include ("http://www.nitr0x.co.uk/$x.php");

and i don't know why
__________________
My signatures!
.Silver is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 11-18-2005   #6 (permalink)
Invicible Snake
 
ParaSnake's Avatar
 
Join Date: Sep 2004
Location: Ho Chi Minh City,Vietnam
Posts: 668

Send a message via MSN to ParaSnake Send a message via Yahoo to ParaSnake
for real,i cant get what u meant lolz
But you shoul always remember to seperate the variables and the string
so it should be :
PHP Code:
include ("http://www.nitr0x.co.uk/".$x.".php"); 
__________________
ParaSnake is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Site Layout in PS Question AdemoS Adobe Photoshop 12 09-18-2005 12:49 AM
PHP Tutorial Trio! Man1c M0g Announcements 3 07-09-2005 09:15 AM
PHP Login Help Space Cowboy HTML / PHP / ASP / JS 11 06-01-2005 10:02 AM
PHP Syntax question BlodoPKNZ HTML / PHP / ASP / JS 9 08-08-2004 09:58 PM
Digital's Quick and Dirty Guide to PHP Order HTML / PHP / ASP / JS 15 05-05-2004 01:18 AM


All times are GMT +1. The time now is 09:26 AM.
Content Relevant URLs by vBSEO 3.2.0

Design & Content © BioRUST 2008 :: PRIVACY STATEMENT :: LEGAL INFORMATION :: ADVERTISING MEDIA KIT