$php_mysql$ Posted August 12, 2011 Share Posted August 12, 2011 so i got my menu in a separate php file whuch u include in every file now the issue is how could i keep ul li selected visiting different pages? Quote Link to comment https://forums.phpfreaks.com/topic/244650-need-some-logic-to-get-menu-li-class-selected/ Share on other sites More sharing options...
the182guy Posted August 12, 2011 Share Posted August 12, 2011 Show the menu PHP code. Also show the relevant code from the page that includes the menu, so we can see how you identify a page. Quote Link to comment https://forums.phpfreaks.com/topic/244650-need-some-logic-to-get-menu-li-class-selected/#findComment-1256617 Share on other sites More sharing options...
$php_mysql$ Posted August 12, 2011 Author Share Posted August 12, 2011 here <!--/*Menu Start*/--> <div id="menu"> <ul> <li><a href="index.php">Home</a></li> <li><a href="aboutus.php">About Us</a></li> <li><a href="faqs.php">Faqs</a></li> <li><a href="contactus.php">Contact Us</a></li> </ul> </div> <!--/*Menu End*/--> this in named as menu.php and i include this in every pages Quote Link to comment https://forums.phpfreaks.com/topic/244650-need-some-logic-to-get-menu-li-class-selected/#findComment-1256623 Share on other sites More sharing options...
$php_mysql$ Posted August 12, 2011 Author Share Posted August 12, 2011 and the other pages are like this <?php include 'functions.php'; ?> <?php include 'header.inc.php'; ?> <title>Contact Us</title> </head> <body> <!--/*Main Start*/--> <div id="main"> <?php include 'header_content.php'; ?> <?php include 'menu.inc.php'; ?> <div id="content_top"></div> <!--/*Content Start*/--> <div id="content"> <div id="title_bar"></div> </div> <!--/*Content End*/--> <div id="content_bottom"></div> <?php include 'footer.inc.php'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/244650-need-some-logic-to-get-menu-li-class-selected/#findComment-1256626 Share on other sites More sharing options...
WebStyles Posted August 12, 2011 Share Posted August 12, 2011 you say it's called menu.php but the one you're including is menu.inc.php Quote Link to comment https://forums.phpfreaks.com/topic/244650-need-some-logic-to-get-menu-li-class-selected/#findComment-1256633 Share on other sites More sharing options...
$php_mysql$ Posted August 13, 2011 Author Share Posted August 13, 2011 sorry its a typo, it is menu.inc.php, so how do i make the li selected any idea? Quote Link to comment https://forums.phpfreaks.com/topic/244650-need-some-logic-to-get-menu-li-class-selected/#findComment-1256738 Share on other sites More sharing options...
$php_mysql$ Posted August 13, 2011 Author Share Posted August 13, 2011 sorted using if else statement and name for each pages in variable Quote Link to comment https://forums.phpfreaks.com/topic/244650-need-some-logic-to-get-menu-li-class-selected/#findComment-1256776 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.