Hi,
My site uses tag's cloud as one of sidebar menus.
I need to be able to add "active" class to chosen option when viewing items list by tag.
I tried to copy solutions from category menu in K2 tools but this needs category id in url to compare. How can I implement it to my site?
Here's what I made with
tags.php (now it compares by tag-name, but JRequest gets it without polish letters and without spaces):
<div id="k2ModuleBox<?php echo $module -> id; ?>" class="k2TagCloudBlock<?php
if ($params -> get('moduleclass_sfx'))
echo ' ' . $params -> get('moduleclass_sfx');
?>">
<?php
$tagname = JRequest::getCmd('tag');
$task = JRequest::getCmd('task');
$output;
$output .= '<ul class="level' . $level . ' menu">';
foreach ($tags as $tag) :
if (!empty($tag -> tag)) :
if (($task == 'tag')&& ($tagname == $tag -> tag)) {
$active = 'active';
} else {
$active = '';
}
$output .= '<li class="' .$active.'" "'. $tag -> tag . '"><a href="' . $tag -> link . '">' . $tag -> tag . '</a></li>';
endif;
endforeach;
$output .= '</ul>';
echo $output;
?>
<div class="clr"></div>
</div>