keeper.garrett1 Posted June 26, 2005 Share Posted June 26, 2005 Hi, very new to php, and in need of some help http://www.renegadesofdeath.co.uk Thats my clan website for a game i play But more to the point, im having trouble getting the php to open any new pages (from the links on the left) to open in the main page. if($id) { include("$id.php"); } else { include("home.php"); } Thats all the php in the main page is. Im not sure how to add to it or anything. I want so that any links that are clicked on will appear where the homepage is. Sorry if this has been asked before, and any help is appreciated. Thanks RoB Quote Link to comment https://forums.phpfreaks.com/topic/2370-navigation/ Share on other sites More sharing options...
Matt B. Posted June 26, 2005 Share Posted June 26, 2005 I'm not sure on this but from what i've seen just put that part in where all the info goes on the home page and it should show up there. Quote Link to comment https://forums.phpfreaks.com/topic/2370-navigation/#findComment-7778 Share on other sites More sharing options...
jeremywesselman Posted June 26, 2005 Share Posted June 26, 2005 [!--PHP-Head--][div class=\'phptop\']PHP[/div][div class=\'phpmain\'][!--PHP-EHead--][span style=\"color:#0000BB\"]<?php [/span][span style=\"color:#FF8000\"]//Use the switch() to set up navigation [/span][span style=\"color:#007700\"]switch([/span][span style=\"color:#0000BB\"]$_GET[/span][span style=\"color:#007700\"][[/span][span style=\"color:#DD0000\"]\'id\'[/span][span style=\"color:#007700\"]]) { case [/span][span style=\"color:#DD0000\"]\'1\'[/span][span style=\"color:#007700\"]: { include([/span][span style=\"color:#DD0000\"]\'page1.php\'[/span][span style=\"color:#007700\"]); } break; case [/span][span style=\"color:#DD0000\"]\'2\'[/span][span style=\"color:#007700\"]: { include([/span][span style=\"color:#DD0000\"]\'page2.php\'[/span][span style=\"color:#007700\"]); } break; default: { include([/span][span style=\"color:#DD0000\"]\'home.php\'[/span][span style=\"color:#007700\"]); } break; } [/span][span style=\"color:#0000BB\"]?>[/span] [/span][!--PHP-Foot--][/div][!--PHP-EFoot--] Then have your menu set up like "index.php?id=1" and it will load page1.php. Jeremy Quote Link to comment https://forums.phpfreaks.com/topic/2370-navigation/#findComment-7779 Share on other sites More sharing options...
Matt B. Posted June 26, 2005 Share Posted June 26, 2005 After the break I would add "default: include("index.php");" so that so when you go to your main page you don't have to type ?id=1 in it. Oops didn't see you had it there because I don't usualy use the break after doing the defualt. Quote Link to comment https://forums.phpfreaks.com/topic/2370-navigation/#findComment-7781 Share on other sites More sharing options...
keeper.garrett1 Posted June 27, 2005 Author Share Posted June 27, 2005 Its sorted now I got a footer.inc and a header.inc put the index.php script into the header.inc and added the include header.php thing at the top of every php page i wanted to link from. Thanks for the help guys. If you want any more info on how i did it i'll write a small know how on another post if you like Thanks for the help anyhoo guys. Appreciated EDIT: I was looking at the countdown timers for php scripts on this site... anyone know of any that go the minute? or the second even? or how to edit those that are there to do that? Quote Link to comment https://forums.phpfreaks.com/topic/2370-navigation/#findComment-7782 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.