Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Determine current page


yanarasod

Recommended Posts

I have a drop-down css menu, what i need is to change the color of the menu depending on the page it is.

 

 

<li><a href="<?php echo tep_href_link(FILENAME_WHERE_TO_BUY); ?>" class="hide"><?php echo FOUR_WHERE_TO_BUY; ?></a>

 

 

Now how do i make this that if the page is FILENAME_WHERE_TO_BUY the menu changes color

 

 

After some searching i found this, but its for wordpress, does any1 know how to do it in OSC.

 

<li<?php

if (is_home())

{

echo " id=\"current\">";

?>

<a href="<?php bloginfo('url') ?>/">Home</a>

<?php

}

?>

 

and css part

#current

{

background-color: #336699;

}

Link to comment
Share on other sites

Tried it but nothing seems to change:

 

rather it shows <![endif]--> with the menu item.

 

The code looks like this:

 

<div class="menu">
<ul>
<li<?php 
if (basename($PHP_SELF) == FILENAME_WHERE_TO_BUY)
{ 
echo " id=\"current\">";
?>
<a href="<?php echo tep_href_link(FILENAME_WHERE_TO_BUY); ?>" class="hide"><?php echo FOUR_WHERE_TO_BUY; ?></a>
<?php 
} 
?>

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

<ul>
<li><a href="<?php echo tep_href_link(FILENAME_BUYONLINE); ?>"><?php echo FOUR_BUY_ONLINE; ?></a></li>
<li><a href="<?php echo tep_href_link(FILENAME_LOCATE_A_STORE); ?>"><?php echo FOUR_LOCATE; ?></a></li>
	</ul>

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

</li>
</ul>
</div>

 

whereas the style sheet is:

 

.menu {	MARGIN: 0px; WIDTH: 850px; FONT-FAMILY: arial, sans-serif
}

.menu UL {	PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 3px; MARGIN: 0px; PADDING-TOP: 0px; LIST-STYLE-TYPE: none
}

.menu UL LI {	FLOAT: left; POSITION: relative
}

.menu UL LI A {	BORDER-RIGHT: #fff 1px solid; BORDER-TOP: #fff 1px solid; DISPLAY: block; FONT-WEIGHT: bold; FONT-SIZE: 11px; BACKGROUND: #a8a8a8; background-image: url('images/bg2.gif'); BORDER-LEFT: #fff 0px solid; WIDTH: 100px; COLOR: #fff; LINE-HEIGHT: 20px; BORDER-BOTTOM: #fff 0px solid; HEIGHT: 20px; TEXT-ALIGN: center; TEXT-DECORATION: none
}

.menu UL LI A:visited {	BORDER-RIGHT: #fff 1px solid; BORDER-TOP: #fff 1px solid; DISPLAY: block; FONT-WEIGHT: bold; FONT-SIZE: 11px; BACKGROUND: #a8a8a8; background-image: url('images/bg2.gif'); BORDER-LEFT: #fff 0px solid; WIDTH: 100px; COLOR: #fff; LINE-HEIGHT: 20px; BORDER-BOTTOM: #fff 0px solid; HEIGHT: 20px; TEXT-ALIGN: center; TEXT-DECORATION: none
}

.menu UL LI UL {	DISPLAY: none}

.menu UL LI:hover A {	BACKGROUND: #6495ed; background-image: url('images/bg1.gif'); COLOR: #fff
}

.menu UL LI:hover UL {	DISPLAY: block; LEFT: 0px; WIDTH: 105px; POSITION: absolute; TOP: 21px;
}

.menu UL LI:hover UL LI A {	DISPLAY: block; BACKGROUND: #a8a8a8; COLOR: #fff;WIDTH: 150px; background-image: url('images/bg2.gif');}

.menu UL LI:hover UL LI A:hover {	BACKGROUND: #6495ed; background-image: url('images/bg1.gif'); COLOR: #fff
}

#current
{
background-color: #336699;
}

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...