genzoshen Posted March 6, 2006 Share Posted March 6, 2006 I want to use SWITCH for a site navigation. something like this[a href=\"http://www.aerogaming.net\" target=\"_blank\"]aerogaming.net[/a]they used "?action=" how do I get started? thanks Quote Link to comment Share on other sites More sharing options...
lessthanthree Posted March 6, 2006 Share Posted March 6, 2006 [!--quoteo(post=352025:date=Mar 6 2006, 09:40 AM:name=Genzoshen)--][div class=\'quotetop\']QUOTE(Genzoshen @ Mar 6 2006, 09:40 AM) [snapback]352025[/snapback][/div][div class=\'quotemain\'][!--quotec--]I want to use SWITCH for a site navigation. something like this[a href=\"http://www.aerogaming.net\" target=\"_blank\"]aerogaming.net[/a]they used "?action=" how do I get started? thanks[/quote]From looking at the site I presume they have a file called index.php that contains the entire layout of the site. Then somewhere in the body they have a statement like below:[code]if (isset($_GET["action"]) { switch($_GET["action"]) { case("page1"): require_once("page1.php"); break; case("page2"): require_once("page2.php"); break; //etc default: require_once("mainpage.php"); }}[/code]of course you can substitute the page names and pages for whatever you desire to use.To initialize the $_GET["action"] variable you need to make your site navigation like the following:[code]<a href='index.php?action=page1'>Page 1 </a><a href='index.php?action=page2'>Page 2 </a>[/code]or if you don't want to use index.php? the following can be used[code]<a href='?action=page1'>Page 1</a><a href='?action=page2'>Page 2</a>[/code]CheersPhil. Quote Link to comment Share on other sites More sharing options...
Guest edwinsweep Posted March 6, 2006 Share Posted March 6, 2006 [!--quoteo(post=352025:date=Mar 6 2006, 10:40 AM:name=Genzoshen)--][div class=\'quotetop\']QUOTE(Genzoshen @ Mar 6 2006, 10:40 AM) [snapback]352025[/snapback][/div][div class=\'quotemain\'][!--quotec--]I want to use SWITCH for a site navigation. something like this[a href=\"http://www.aerogaming.net\" target=\"_blank\"]aerogaming.net[/a]they used "?action=" how do I get started? thanks[/quote]the "?action=" behind a url like this "index.php?action=logout"thats a value you will pass on to the next page trough the $_GET commandif the index.php page that you can see in the link contains the following code[code]if (isset($_GET[action])){//if true do this}else{//if not true do this}[/code]it will check to see if the variable is indeed passed on and based on that it will create the rest of the page!for more info you should search the net for lessons about variables, and passing on variables to other pages!there are enough tutorials on the internet to learn this concept in only a few minutes.[a href=\"http://www.tizag.com\" target=\"_blank\"]http://www.tizag.com[/a] is a pretty good one i think.good luck! 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.