PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Mon May 29, 2017 10:25 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 60 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
 Post subject:
PostPosted: Thu Oct 13, 2005 9:22 am 
Offline
DevNet Master
User avatar

Joined: Mon Sep 19, 2005 6:24 am
Posts: 3587
Location: London
This way is better:

Syntax: [ Download ] [ Hide ]
<?php



$pages = array('main.php', 'blah.php', 'foo.php');



isset($pages[$_GET['p']]) ? include($pages[intval($_GET['p'])]) : include('default.php');



?>


Last edited by Jenk on Thu Oct 13, 2005 9:30 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 13, 2005 9:25 am 
Offline
Neighborhood Spidermoddy
User avatar

Joined: Mon Mar 29, 2004 4:24 pm
Posts: 31559
Location: Bothell, Washington, USA
pssst.. should check for the file's existance too, just in case. ;)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 13, 2005 9:31 am 
Offline
DevNet Master
User avatar

Joined: Mon Sep 19, 2005 6:24 am
Posts: 3587
Location: London
Yeah yeah smarty pants :P

But one assumed that one would only add valid and existing file names to the array :P

What's that? Assumptions are the mother of all ... oh.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 07, 2007 5:17 pm 
Offline
Forum Commoner
User avatar

Joined: Thu Jul 10, 2003 11:11 pm
Posts: 81
Location: Orland Park, IL
Jenk wrote:
This way is better:

Syntax: [ Download ] [ Hide ]
<?php

$pages = array('main.php', 'blah.php', 'foo.php');

isset($pages[$_GET['p']]) ? include($pages[intval($_GET['p'])]) : include('default.php');

?>


The problem I'm having, is that I am working with a LARGE number of pages... How do I get around typing them all into an array?


Sorry for the thread necromancy.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 07, 2007 5:38 pm 
Offline
DevNet Master
User avatar

Joined: Sun Jan 21, 2007 12:06 am
Posts: 4135
You could have started a new one and then just linked to this one.

And the answer to your question is databasing.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 07, 2007 6:24 pm 
Offline
Forum Commoner
User avatar

Joined: Thu Jul 10, 2003 11:11 pm
Posts: 81
Location: Orland Park, IL
superdezign wrote:
You could have started a new one and then just linked to this one.



I didn't know this one existed, but thanks though.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 07, 2007 6:58 pm 
Offline
Forum Regular
User avatar

Joined: Wed Jul 30, 2003 3:29 am
Posts: 875
Location: Sweden
mabufo wrote:
superdezign wrote:
You could have started a new one and then just linked to this one.



I didn't know this one existed, but thanks though.


IF you didn't know this one existed, then how come replied in it? :d
Databasing is the way to go in my opinion, an ini-file of some sort could suffice though.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 07, 2007 8:40 pm 
Offline
Forum Commoner
User avatar

Joined: Thu Jul 10, 2003 11:11 pm
Posts: 81
Location: Orland Park, IL
When you guys say databasing... what exactly are you talking about?

Someone PM me.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 07, 2007 8:49 pm 
Offline
Neighborhood Spidermoddy
User avatar

Joined: Mon Mar 29, 2004 4:24 pm
Posts: 31559
Location: Bothell, Washington, USA
A database supplied list of "valid" files.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 07, 2007 8:54 pm 
Offline
Forum Commoner
User avatar

Joined: Thu Jul 10, 2003 11:11 pm
Posts: 81
Location: Orland Park, IL
feyd wrote:
A database supplied list of "valid" files.


See guys, sometimes it pays off to be a little less vague, then maybe the person asking for help could actually get somewhere.

Thank you feyd.

This brings up the all important question, how do I do that? Give me a phrase to search google for, something.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 07, 2007 9:01 pm 
Offline
Neighborhood Spidermoddy
User avatar

Joined: Mon Mar 29, 2004 4:24 pm
Posts: 31559
Location: Bothell, Washington, USA
What do you think it means?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 07, 2007 9:06 pm 
Offline
Forum Commoner
User avatar

Joined: Thu Jul 10, 2003 11:11 pm
Posts: 81
Location: Orland Park, IL
feyd wrote:
What do you think it means?


I'm not a database developer, and you are not being helpful.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 07, 2007 9:13 pm 
Offline
Neighborhood Spidermoddy
User avatar

Joined: Mon Mar 29, 2004 4:24 pm
Posts: 31559
Location: Bothell, Washington, USA
mabufo wrote:
I'm not a database developer, and you are not being helpful.
I may as well live up to that expectation then.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 07, 2007 9:17 pm 
Offline
Forum Commoner
User avatar

Joined: Thu Jul 10, 2003 11:11 pm
Posts: 81
Location: Orland Park, IL
feyd wrote:
mabufo wrote:
I'm not a database developer, and you are not being helpful.
I may as well live up to that expectation then.

Do you give everyone the runaround like this? Or just the folks who need assistance?

EDIT: Seriously now, I come on here asking for assistance - and all you can do is poke fun at me because I don;t know what you're talking about? I thought you were supposed to be a moderator?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 07, 2007 9:38 pm 
Offline
Neighborhood Spidermoddy
User avatar

Joined: Mon Mar 29, 2004 4:24 pm
Posts: 31559
Location: Bothell, Washington, USA
mabufo wrote:
Do you give everyone the runaround like this? Or just the folks who need assistance?

EDIT: Seriously now, I come on here asking for assistance - and all you can do is poke fun at me because I don;t know what you're talking about? I thought you were supposed to be a moderator?
If you're expecting a complete and total answer, which it seems you are, you'll likely be waiting some time. Many of us choose to nudge in the proper directions allow others to learn and think for themselves instead of spoon feeding answers. If you're unwilling to think on your own, or at least attempt things, then I am just as unwilling to give my time.

Now, if you had said "I have no idea where to begin in making a database return a list," instead of demanding something, you may have gotten a different response, albeit just as cryptic most likely. I don't know your personal history so I can only assume the basics of PHP knowledge which includes a minor understanding of database interaction since it's fairly fundamental to the language and the business. So, if that's wrong, tell us.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 60 posts ]  Go to page Previous  1, 2, 3, 4  Next

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group