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? Link to comment https://forums.phpfreaks.com/topic/36524-pages/ 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; } ?> Link to comment https://forums.phpfreaks.com/topic/36524-pages/#findComment-173904 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 ) ; Link to comment https://forums.phpfreaks.com/topic/36524-pages/#findComment-173927 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'); } Link to comment https://forums.phpfreaks.com/topic/36524-pages/#findComment-173945 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"){ Link to comment https://forums.phpfreaks.com/topic/36524-pages/#findComment-173986 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? Link to comment https://forums.phpfreaks.com/topic/36524-pages/#findComment-174037 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 Link to comment https://forums.phpfreaks.com/topic/36524-pages/#findComment-174052 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'); } Link to comment https://forums.phpfreaks.com/topic/36524-pages/#findComment-174076 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'); } ?> Link to comment https://forums.phpfreaks.com/topic/36524-pages/#findComment-174079 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.