campjacob Posted August 9, 2008 Share Posted August 9, 2008 I'm fairly new to php, and currently transitioning my site (http://jacobrcampbell.com) to utilizing the php include language for many parts of my page. I have run into trouble with using the include for my menu. Traditionally I have individually coded my menu on each page, and allowed me to add context information. I want to be able to use the include() to add in my menu on all pages, but have the way it looks change based on the specific url the menu is currently being included in. My menu looks something like the following; <dd id="active"><a href="http://jacobrcampbell.com/index.php">Home</a></dd> <dd class="contextMenu"><a href="http://jacobrcampbell.com/contact.php">Contact</a></dd> ...etc The id="active" changes what the menu item looks like based on it being the current page that I'm on. the class="contextMenu" are pages that are specific to current current page on (i.e. I have been trying to say "if current page == specific url than show this context menu item). the context menu might be different if the browser was on my "http://resources.jacobrcampbell.com/" pages verses the normal directory. I have been trying to pass the URL information though the setcookie() function... but have not been able to get the coding correct. Thanks for the help. Link to comment https://forums.phpfreaks.com/topic/118897-create-a-menu-based-on-specific-urls/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.