Jump to content


Photo

Switch Conditionals


  • Please log in to reply
2 replies to this topic

#1 redfire

redfire
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 29 October 2006 - 03:27 AM

Okay I'm currently working on a new template, and instead of making a hole new page for every thing I'm setting it up just it just changes the one area.

<?php switch($_GET['id']) 
{
default:
   include('home.php');
  break;  
case 'news':
   include('news.php');
  break;  
case 'forums':
   include('forums.php');
  break;  
}
?>

and I have the links set-up like

<a href="index.php?id=news">News</a>[quote][/quote]

I have it set-up like that but it doesn't want to work :(

#2 toplay

toplay
  • Staff Alumni
  • Advanced Member
  • 973 posts

Posted 29 October 2006 - 03:34 AM

It looks ok except put the "default" case as the last one.

See:

http://us2.php.net/m...tch.php#AEN5024


#3 redfire

redfire
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 29 October 2006 - 03:39 AM

fixed thanks :D




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users