daebat Posted October 8, 2009 Share Posted October 8, 2009 I am building a PHP based template and I'm having some troubles with the menu. How do I get the links in the menu to open inside the content area without rebuilding the template on each page? Link to comment https://forums.phpfreaks.com/topic/176960-solved-menu-question/ Share on other sites More sharing options...
Bricktop Posted October 8, 2009 Share Posted October 8, 2009 Hi daebat, Use a case switch to achieve this. Have a look here for a tutorial on this. Hope this helps. Link to comment https://forums.phpfreaks.com/topic/176960-solved-menu-question/#findComment-933034 Share on other sites More sharing options...
daebat Posted October 8, 2009 Author Share Posted October 8, 2009 Thanks, I'm having a few problems that maybe you can help me with: I've set up links.php and include it in index.php. I set my menu links to index.php?page=1 (2,3,4,5, etc.) Now I'm confused as to where I should put <?php require("links.php"); ?> I tried setting it in index.php under the menu include and it gives me errors. I put it in the content page itself and it gives me a fatal error: exhausted memory... Any ideas? Link to comment https://forums.phpfreaks.com/topic/176960-solved-menu-question/#findComment-933074 Share on other sites More sharing options...
Bricktop Posted October 8, 2009 Share Posted October 8, 2009 Hi daebat, Can you post your full code and we'll be able to give a more definitive answer. Thanks. Link to comment https://forums.phpfreaks.com/topic/176960-solved-menu-question/#findComment-933077 Share on other sites More sharing options...
daebat Posted October 8, 2009 Author Share Posted October 8, 2009 links.php <?php switch($pageid) { case "1": include('fscorplogo.php'); break; case "2": include('brandlogos.php'); break; case "3": include('brandlogos.php'); break; default: include('home.php'); } ?> index.php </head> <body> <?php include ("includes/header.php"); ?> <?php include ("includes/menu.php"); ?> <?php include ("includes/links.php"); ?> <?php include ("includes/footer.php"); ?> </body></html> menu.php <div id="menu"> <h3 style="cursor: pointer;" onclick="expandcontent('sc1')">LOGO CATALOG</h3> <div id="sc1" class="switchcontent" style="display: none;"> <a href="index.php?page=1">FS CORPORATE LOGO</a> <br/> <a href="index.php?page=2">BRAND LOGOS</a> </div> </div> So my question is where should I be placing <?php require("links.php"); ?> Link to comment https://forums.phpfreaks.com/topic/176960-solved-menu-question/#findComment-933085 Share on other sites More sharing options...
Bricktop Posted October 8, 2009 Share Posted October 8, 2009 Hi daebat, I've just read through that tutorial and it's not particularly clear, for example swicth($pageId) is not going to work, it needs to be something like switch($_GET['page']). The include is fine where it is in the index.php page, give the above edit a go and see what happens. Hope this helps. Link to comment https://forums.phpfreaks.com/topic/176960-solved-menu-question/#findComment-933100 Share on other sites More sharing options...
daebat Posted October 8, 2009 Author Share Posted October 8, 2009 That worked! Thanks buddy! Link to comment https://forums.phpfreaks.com/topic/176960-solved-menu-question/#findComment-933105 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.