Recent Topics

1 Apr 07, 2007 03:16    

My b2evolution Version: 1.9.x

Yabba helped me with this solution for highlighting the current "disp=" menu item and it works a treat.

It is added within the head of _main.php

#disp_<?php echo $disp; ?> a {
background:#FFFFF2;
color:#C60;
border-left:4px solid #D95;
}

QUESTION.
Is there a similar dynamic call that will do the same for styling the current category menu item
I

#cat=<?php echo $cat; ?> a {
background:#FFFFF2;
}


generates #cat=5 but how do I relate that to the unique ID for the Category list?

Any suggestions welcomed
Cheers

4 May 03, 2007 16:04

If you find this section of the categories plugin ( approx line 290 ) and modify it as follows then you should get the results you want :

		$r .= '" id="cat'.$cat_ID.'">'.format_to_output($cat['cat_name'], 'htmlbody').'</a> <span class="notes">('.$cat['cat_postcount'].')</span>';

		if( in_array( $cat_ID, $cat_array ) )
		{ // This category is in the current selection
			$r .= '*';
		}

Totally untested of course :D

¥

5 May 03, 2007 16:19

Great, I'll give it a spin and yell out either way :)

6 May 03, 2007 16:46

Nope... I can't get that to work... ( not a surprise )
In the head of my _main.php I have

#cat=<?php echo $cat; ?> a {
background:#FFFFF2;
}

and in the categories plugin I have

$r .= '" id="cat'.$cat_ID.'">'.format_to_output($cat['cat_name'], 'htmlbody').'</a>';

		if( in_array( $cat_ID, $cat_array ) )
		{ // This category is in the current selection
			$r .= '';
		}

7 May 03, 2007 16:49

Got a link to where it fails?

¥

8 May 03, 2007 16:58

Yep... got to wow-factor.com and click on any of the top right Category menu items and compare that to clicking on the menu group below that with all the $disp=, which work fine and highlight the active link.
The embedded css renders as follows...

#disp_posts a {
background:#578;
color:#fd7;
border-left:4px solid #D95;
}
#cat=1 a {
background:#578;
color:#fd7;
border-left:4px solid #D95;
}

9 May 03, 2007 17:11

This is interesting... I'll give it a spin as well..

10 May 03, 2007 17:13

Muppet wrote:

#cat=1

:|

¥

12 May 03, 2007 17:18

#cat= is not *quite* the match for id="cat1" ;)

¥

13 May 03, 2007 18:26

OK... I can generate

#cat1 {
background:#578;
color:#fd7;
border-left:4px solid #D95;
}


with...

#cat<?php echo $cat; ?> {
background:#578;
color:#fd7;
border-left:4px solid #D95;
}


and this gives me an "active" background .
Now I just have to tweak to get "active" text ....

Slowly the penny drops :)

14 May 03, 2007 18:40

John wrote:

color:#fd7;

current css wrote:

#bSideBar a {
border-bottom:0pt none;
color:#EEEEEE;
}

;)

¥

15 May 03, 2007 18:57

These lists are in #bSideBar .bSideItem a{} although they are a convoluted mess right now :)

In the end I compromised ..... Thanks for the subtle tips Killer , much appreciated.

Updated: Fully functional Active state for Categories.
Just edited the CSS in the head of _main.php

#bSideBar .bSideItem #cat<?php echo $cat; ?> {
color:#fd8;
background:#578;
border-left:1px solid #fd8;
}


Form is loading...