PDA

View Full Version : Category Link Highlight help needed


lokjah
12-14-2005, 10:25 PM
I have an unordered list where I am linking to browse categories like so:


<ul id="portfoliocatlist">
<li><a href="/portfolio/index.php?x=browse&amp;category=1">Commercial-Restaurant</a></li>
</ul>



I am using that on both my browse_template and my image_template in a sidebar to provide a navigation.

What I would like to achieve is to have the list item display on the hover state (highlighted) depending which image is being displayed

(if an image from the Commericial-Restaurant category is being displayed then that link in the list will be highlighted)


the css/xhtml part is a snap, I just need help with the pixelpost bit.

I tried (lol) to create an addon but it was too over my head to understand what I needed to get from the db. in a nutshell heres what I tried:


<ul id="portfoliocatlist">
<li<?php if ($image_category_number== "1")
echo " id=\"currentpage\""; ?>><a href="/portfolio/index.php?x=browse&amp;category=1">Commercial-Restaurant</a></li>
</ul>

<?php
$tpl = str_replace("<PORTFOLIO_NAV>",$image_category_number,$tpl);
?>



I then tried something to this effect:



<?php


$image_category_link .= "<a href='$PHP_SELF?x=browse&amp;category=$cat_id'>" .$cfgrow['catgluestart'] .$name .$cfgrow['catglueend']."</a> &nbsp;";


?>



<?php

$tpl = str_replace("<MY_IMAGE_CATEGORY>",$image_categoryword." ".$image_category_link,$tpl);

?>


then with that I was going to insert <MY_IMAGE_CATEGORY> back into my li's like so:



<li id="<MY_IMAGE_CATEGORY>"><a href="/portfolio/index.php?x=browse&amp;category=1">Commercial-Restaurant</a></li>


thinking that it would output the category name (Commercial-Restaurant) that I could use as an id for my css

TIA for any help

-clint

lokjah
12-18-2005, 02:06 PM
anyone? am I headed in any sort of the right direction in the addons?

thanks.

tinyblob
12-18-2005, 04:56 PM
i'll get back to you on this one after i've eaten, haven't got the energy to think yet ;)

lokjah
12-19-2005, 02:48 PM
thanks tinyblob :)

tinyblob
12-19-2005, 03:45 PM
Didn't get back to this last night - sorry.
I have a similar function in my upcoming categories addon. Basically what it does is gets a list of categories from the DB, then checks to see which one is currently being viewed, and highlights that one (while looping through the categories).
Your problem is going to be that an image can be in multiple categories.

lokjah
12-19-2005, 09:26 PM
yeah, that is true, all of the images are only assigned one category per image so that should be fine. what would happen if an image then had another category, would there be no highlighting, or would things get screwy like both categories highliting?