Jump to content

can PHP recognize the url structure?


thindery1

Recommended Posts

I need to design a function so that when a user is viewing my forum instead of other pages, it hi lights the tab specified forum in my header navigation.

 

If the url link is http://domain.com/forum/

 

and my posts are viewed like: http://domain.com/forum/topic?id=x

 

is it possible to have php figure out that when the url has http://domain.com/forum/ in it, to display the certain function?  You can see how I am using it below.

<?
//part of header tab links

if (*url contains http://domain.com/forum/*) {
  $addclass = ' class="current_page"';
  } else {
  $addclass = '';
  }
echo "<li" . $addclass . "><a href='" . get_option('forum') . "/' title='Forum'><span>Forum</span></a></li>";
?>

Link to comment
https://forums.phpfreaks.com/topic/148121-can-php-recognize-the-url-structure/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.