PHP Navigation

CrazyImpling

New Member
Reaction score
3
Alrighty, now that I got my main page displaying fixed, I'm kind of looking for some help with the PHP navigation thingy.

So I have a link: ***/index.php?p=news
I was wondering, how does that work?

switch($_GET['p']) {

case "news":
include 'news.php';
break;
}

Doesn't seem to work how I was thinking it would, it just adds it at the bottom of the page?
 

mase

____ ___ ____ __
Reaction score
154
PHP:
$allowedptags = array('news', 'index') //Add the other page labels as well this is for security reasons
if(isset($_GET['p']) && in_array($_GET['p'], $allowedptags)){
$var = $_GET['p'];
} else {
$var = 'index';
}
switch($var){
case 'news':
include ('news.php');
break;
case 'index':
//do w/e;
break;
}
I don't see why yours doesn't work.
I'm assumin there is a news.php also.
 

CrazyImpling

New Member
Reaction score
3
Okay, that was just plain wacked.. I tried that and it just kept adding pages onto the bottom of what I had. It kept loading more and more, went for around 4 minutes until I stopped it.

Does it have to be in a frame or something?
 

mase

____ ___ ____ __
Reaction score
154
Okay, that was just plain wacked.. I tried that and it just kept adding pages onto the bottom of what I had. It kept loading more and more, went for around 4 minutes until I stopped it.

Does it have to be in a frame or something?

Do you have an unclosed loop above the switch? That should not happen if you don't.
 

CrazyImpling

New Member
Reaction score
3
Oh, haha! Figured it out. My link had an incorrect term in it causing it to screw up. Anyways, thanks for your help!

EDIT: Nevermind... It's messed up again, it's loading the included page starting at 50% of the screen and under the other page that was there.
 

mase

____ ___ ____ __
Reaction score
154
Do you have a link so I can see what is wrong?
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top