Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Navigation Solution Needed (?p=blah)
Old 02-22-2009, 04:27 PM Navigation Solution Needed (?p=blah)
Average Talker

Posts: 15
Name: Declan Dowling
Trades: 0
Hello,

I'm working on a site and have hit a bit of a problem when it comes to specific pages such as profiles.

I have decided to opt for the commonly used method of ?page=home and then include the home.php file.

Here is an example of how im doing it:
PHP Code:
if  ($page == 'tos'){             $include 'tos.php';}
elseif  (
$page == 'updates'){    $include 'news_updates.php';}
elseif  (
$page == 'credits'){    $include 'credits.php';    } 
But when it comes to a page that has its own ?= on the end, eg profile.php?view=Declan, I'm stuck on how to get around it.

All help will be appreciated, thanks.
Declan.
Declan is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-22-2009, 04:31 PM Re: Navigation Solution Needed (?p=blah)
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
Using the example you provided, if you just add the view parameter to your url. profile.php should still be able to retrieve it
ie:
Code:
?page=profile&view=Declan
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Last edited by NullPointer; 02-22-2009 at 05:38 PM..
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 02-22-2009, 04:37 PM Re: Navigation Solution Needed (?p=blah)
Average Talker

Posts: 15
Name: Declan Dowling
Trades: 0
Im an idiot.
Thanks lol.
Declan is offline
Reply With Quote
View Public Profile
 
Old 02-22-2009, 06:22 PM Re: Navigation Solution Needed (?p=blah)
rogem002's Avatar
PHP Chap

Posts: 843
Name: Mike
Location: United Kingdom
Trades: 0
Quote:
Originally Posted by Declan View Post
Im an idiot.
Thanks lol.
That just made my day heh ^^ +talkupation.
__________________
My Blog/Site:
Please login or register to view this content. Registration is FREE
rogem002 is offline
Reply With Quote
View Public Profile Visit rogem002's homepage!
 
Old 02-23-2009, 12:04 AM Re: Navigation Solution Needed (?p=blah)
lizciz's Avatar
Super Spam Talker

Posts: 807
Name: Mattias Nordahl
Location: Sweden
Trades: 0
I thought I'd give you a small tip. It may not be *better* but at least I find it easier to read than alot if if's, especially when you have alot of pages.

PHP Code:
$allowed = array(
   
'tos'        => 'tos.php',
   
'updated'  => 'news_updates.php',
   
'credits'    => 'credits.php'
);
if (isset(
$_GET['page']) && in_array($_GET['page'], $allowed)) {
   require 
$allowed[$_GET['page']];
} else {
   require 
'some_standard_page.php';

Cheers!
lizciz is offline
Reply With Quote
View Public Profile Visit lizciz's homepage!
 
Reply     « Reply to Navigation Solution Needed (?p=blah)
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.18189 seconds with 12 queries