Jump to content

[SOLVED] finding a "like" current page


samoht

Recommended Posts

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
Share on other sites

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.