Code: Select all
<?php
$pages = array('main.php', 'blah.php', 'foo.php');
isset($pages[$_GET['p']]) ? include($pages[intval($_GET['p'])]) : include('default.php');
?>Moderator: General Moderators
Code: Select all
<?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?Jenk wrote:This way is better:
Code: Select all
<?php $pages = array('main.php', 'blah.php', 'foo.php'); isset($pages[$_GET['p']]) ? include($pages[intval($_GET['p'])]) : include('default.php'); ?>
IF you didn't know this one existed, then how come replied in it? :dmabufo wrote:I didn't know this one existed, but thanks though.superdezign wrote:You could have started a new one and then just linked to this one.
See guys, sometimes it pays off to be a little less vague, then maybe the person asking for help could actually get somewhere.feyd wrote:A database supplied list of "valid" files.
Do you give everyone the runaround like this? Or just the folks who need assistance?feyd wrote:I may as well live up to that expectation then.mabufo wrote:I'm not a database developer, and you are not being helpful.
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.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?