Greenie Posted November 29, 2006 Share Posted November 29, 2006 Hey all,I've been trying to figure out the best way to code a menu so that it is easily updated. I thought of storing the menu options in a database, but then I've no way of defining submenu values unless I create several tables and then I'm not sure how I would reference them. I apologise if I'm not making much sense, I don't really know what I'm doing. Is there a conventional, or better way of doing this?Thanks,Greenie. Link to comment https://forums.phpfreaks.com/topic/28812-best-way-to-code-a-menu/ Share on other sites More sharing options...
sw0o0sh Posted November 29, 2006 Share Posted November 29, 2006 [code]<?PHPif($_GET[switch]){setcookie("view",$_GET[switch],time()+(60*60*24*5), "/", "");header('Location:index.php?done');}?><html><head><title></title></head><body><?PHPif($_COOKIE[view]==1){ echo "<a href='index.php?'>blabla</a><br />"; echo "<a href='index.php?switch=blank'>select new menu</a>";}else if($_COOKIE[view]==2){ echo "<a href='index.php?'>blabla</a><br />"; echo "<a href='index.php?switch=blank'>select new menu</a>";}else if($_COOKIE[view]==3){ echo "<a href='index.php?'>blabla</a><br />"; echo "<a href='index.php?switch=blank'>select new menu</a>";}else{ echo "<a href='index.php?switch=1'>Menu 1</a><br />"; echo "<a href='index.php?switch=2'>Menu 2</a><br />"; echo "<a href='index.php?switch=3'>Menu 3</a><br />";}?></body></html>[/code]Hurray for cookies, 1000 menus, one page. Link to comment https://forums.phpfreaks.com/topic/28812-best-way-to-code-a-menu/#findComment-131895 Share on other sites More sharing options...
Greenie Posted November 29, 2006 Author Share Posted November 29, 2006 Thankyou for your reply, sw0o0sh.I'm not sure how this will help me. How do I use it and what results will I get? Perhaps if you explained what the code does briefly, I will understand. Thanks again. Link to comment https://forums.phpfreaks.com/topic/28812-best-way-to-code-a-menu/#findComment-131938 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.