1 Replies - 22908 Views - Last Post: 01 February 2007 - 03:21 AM Rate Topic: -----

#1 lance  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 43
  • Joined: 30-January 07

Using PHP to highlight current item in menu

Posted 31 January 2007 - 11:44 PM

Now I have this dropdown menu in CSS & PHP, The trick will be to making the menu item STAY the color (based on the area you're in - somehow, it would need to know the architecture of the site - pulling from the URL to know when to KEEP the menu item highlighted.

Is there any way using PHP to determine the current page and highlight the respective menu item.

<div class="menu">
<ul>
<li><a href="<?php echo tep_href_link(FILENAME_ALL; ?>" class="hide"><?php echo ONE_OUR; ?></a>

<!--[if lte IE 6]>
<a href="<?php echo tep_href_link(FILENAME_ALL); ?>"><?php echo ONE_OUR; ?> 
<table><tr><td>
<![endif]-->

	<ul>
	<li><a href="<?php echo tep_href_link('index.php', 'cPath=21'); ?>"><?php echo ONE_MENU; ?></a></li>
	<li><a href="<?php echo tep_href_link('index.php', 'cPath=26'); ?>"><?php echo ONE_GREEN; ?></a></li>
	<li><a href="<?php echo tep_href_link('index.php', 'cPath=25'); ?>"><?php echo ONE_BLACK; ?></a></li>
	<li><a href="<?php echo tep_href_link('index.php', 'cPath=22'); ?>"><?php echo ONE_WHITE; ?></a></li>
	<li><a href="<?php echo tep_href_link('index.php', 'cPath=24'); ?>"><?php echo ONE_FLAVOURED; ?></a></li>
	<li><a href="<?php echo tep_href_link('index.php', 'cPath=23'); ?>"><?php echo ONE_BAGS; ?></a></li>
	<li><a href="<?php echo tep_href_link('index.php', 'cPath=27'); ?>"><?php echo ONE_MIXED; ?></a></li>
	
	</ul>

<!--[if lte IE 6]>
</td></tr></table>
</a>
<![endif]-->

</li>

This post has been edited by lance: 01 February 2007 - 03:05 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Using PHP to highlight current item in menu

#2 capty99  Icon User is offline

  • i am colt mccoy
  • member icon

Reputation: 98
  • View blog
  • Posts: 10,081
  • Joined: 26-April 01

Re: Using PHP to highlight current item in menu

Posted 01 February 2007 - 03:21 AM

im sure there is a better way to do this but real quick and dirty send an id with the link so http://yoursite.com?id=#

and then for each link check if 'id' == #, then highlight link

REAL dirty.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1