samoht Posted July 24, 2007 Share Posted July 24, 2007 ok, back for more I now have my queries and the main level ul class changes nicely to "current" showing the user where they are. However, I want to keep the main tab current if the user navigates inside the pages available under that tab. (e.g. sauser.php is a sub link under the "Secure Access" tab. once there a user can navigate to sauseredit.php or sauserview.php - fortunately the new pages will always start with the same base page in there names <?php $page = basename($_SERVER['SCRIPT_NAME']); while ($row = mysql_fetch_assoc($navBarsSA)) { $linkurls[] = $row['LinkURL']; // add new array element to $linkurls, an array if ($row['LinkURL'] == $page) { $currentType = $row['Type']; }?> - so if I could check for what ever comes before the .php and then test to see if that starts the name of the new page navigated too then I could keep the proper tab current) or if the if($row['LinkURL']==$page) could be Like%...% istead of == ? hopefullly that all makes sense. Any ideas? Link to comment https://forums.phpfreaks.com/topic/61471-solved-finding-a-like-current-page/ Share on other sites More sharing options...
JayBachatero Posted July 24, 2007 Share Posted July 24, 2007 Change the if($row['LinkURL']==$page) to this. if (strtolower($row['LinkURL']) == substr(strtolower($page), 0, -4)) Link to comment https://forums.phpfreaks.com/topic/61471-solved-finding-a-like-current-page/#findComment-305956 Share on other sites More sharing options...
samoht Posted July 24, 2007 Author Share Posted July 24, 2007 changing to that did not work? <?php while ($row = mysql_fetch_assoc($navBarsSA)) { $linkurls[] = $row['LinkURL']; // add new array element to $linkurls, an array if (strtolower($row['LinkURL']) == substr(strtolower($page), 0, -4)) { $currentType = $row['Type']; } }?> is the syntax correct the way I have it? Link to comment https://forums.phpfreaks.com/topic/61471-solved-finding-a-like-current-page/#findComment-306241 Share on other sites More sharing options...
samoht Posted July 24, 2007 Author Share Posted July 24, 2007 I found my problem ans switched the order <?php $rpage = basename($_SERVER['SCRIPT_NAME']); $page = substr(($rpage),0,6); //stuff... if (substr(($row['LinkURL']),0,6) == $page) the shorest link I have was 6 characters long so this works just fine as long as my links are unique with in the first 6 characters. Thanks for the help!! Link to comment https://forums.phpfreaks.com/topic/61471-solved-finding-a-like-current-page/#findComment-306332 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.