1grant1 Posted January 31, 2007 Share Posted January 31, 2007 I don’t know if this is possible but i have pages within pages but I’m trying to put something in to my webpage that uses its own pages within pages for example- example.com/index.php?page=page2?admin=info that’s what I’m trying to get how would I put them all together? Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted January 31, 2007 Share Posted January 31, 2007 This is a rough example, but somthing like this could work: <?php switch($_GET['page']){ case 2: switch($_GET['admin']){ case "admin": echo 'Admin Page # '.$_GET['page']; break; case "user": echo 'User Page # '.$_GET['page']; break; } break; default: echo 'Default Page'; break; } ?> Quote Link to comment Share on other sites More sharing options...
tarun Posted January 31, 2007 Share Posted January 31, 2007 Or Something Like If ( $page==1 ) echo( Page 1 Content ) ; else If ( $page==2 ) echo( Page 2 Content ) ; else If ( $page==3 ) echo( Page 3 Content ) ; else echo( Sorry Page Not Found ) ; Quote Link to comment Share on other sites More sharing options...
1grant1 Posted January 31, 2007 Author Share Posted January 31, 2007 so should this work ...its on page 6 if ($page == "page1"){ $a =1; $file = 1; }elseif ($page == "page2"){ $b = 1; $file = 2; }elseif ($page == "page3"){ $c = 1; $file = 3; }elseif ($page == "page4"){ $d = 1; $file = 4; }elseif ($page == "page5"){ $e = 1; $file = 5; }elseif ($page == "page6"){ switch($_GET['admin']){ case "admin": echo 'Admin Page # '.$_GET['page']; break; $f = 1; $file = 6; } }else { $a = News; $file = include ('news.news'); } Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted January 31, 2007 Share Posted January 31, 2007 as long as you have this: $page = $_GET['page']; before this: if ($page == "page1"){ Quote Link to comment Share on other sites More sharing options...
1grant1 Posted January 31, 2007 Author Share Posted January 31, 2007 so i would call that by going index.php?page=page6?admin right? Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted January 31, 2007 Share Posted January 31, 2007 no index.php?page=page6?admin=admin Quote Link to comment Share on other sites More sharing options...
1grant1 Posted January 31, 2007 Author Share Posted January 31, 2007 well I must be doing somthing wrong becasue it wont show up as anything it just brings me back to the default page $page = $_GET['page']; if ($page == "page1"){ $a = include ('news.news'); $file = News; }elseif ($page == "page2"){ $b = 2; $file = include ('iframe_chat.php'); }elseif ($page == "page3"){ $c = 1; $file = 3; }elseif ($page == "page4"){ $d = 1; $file = 4; }elseif ($page == "page5"){ $e = 1; $file = 5; }elseif ($page == "page6"){ switch($_GET['admin']){ case "admin": echo 'Admin Page # '.$_GET['page']; break; $f = 1; $file = 6; } }else { $a = News; $file = include ('news.news'); } Quote Link to comment Share on other sites More sharing options...
marcus Posted January 31, 2007 Share Posted January 31, 2007 You could something like this, naming all your files like page1.php page2.php <?php $page = $_GET['page']; if(isset($page)){ $page = "$page.php"; if(file_exists($page)){ include($page); }else { echo "page does not exist"; } }else { include('index.php'); } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.