Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-06-20 18:51:20

mwr
Member
From: Canada
Registered: 2006-01-31
Posts: 167
Website

get active_class to work in with txp:category_list

I’m using txp:category_list to output a list of categories, which works fine. I even have it styled the way I like.

I want the current category to be highlighted, but I can’t get the active_class attribute to work. Here is the tag:

txp:category_list active_class=“active” break=“li” wraptag=“ul”

And here is the CSS:

.active { color: #fff; background: #7c2c2c; }

When I view the page source, an active class is nowhere to be found.

I’m using Textpattern 4.0.4.

What am I doing wrong?


Mark

Offline

#2 2007-06-20 20:23:41

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: get active_class to work in with txp:category_list

Are you sure you are looking at a category (list) page? It doesn’t work on individual article pages. (Meaning: the category must be in the URL.)

Offline

#3 2007-06-20 20:25:04

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: get active_class to work in with txp:category_list

Can you provide an URL that demonstrates the problem?

Like Els says, the URL should contain ?c=categoryname or /category/categoryname

Last edited by ruud (2007-06-20 20:25:59)

Offline

#4 2007-06-20 20:45:30

mwr
Member
From: Canada
Registered: 2006-01-31
Posts: 167
Website

Re: get active_class to work in with txp:category_list

The URLs work like this:

http://www.example.com/mapleleaf/category/entertainment/


Mark

Offline

#5 2007-06-20 21:10:15

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: get active_class to work in with txp:category_list

Perhaps this FAQ item will help you diagnose the problem. If not, I’d love to see the complete tag trace (explained in the FAQ) and the part of the template that contains the <txp:category_list /> tag.

Offline

#6 2007-06-20 21:10:22

mwr
Member
From: Canada
Registered: 2006-01-31
Posts: 167
Website

Re: get active_class to work in with txp:category_list

I did some hunting around in the forums and found that people couldn’t make active_class work if the name of the category (or section) had a capital letter in it. I went to content:organize:article categories, and changed the names to all lower case. That plus more precision with the CSS did the trick.

Does this count as a bug?


Mark

Offline

#7 2007-06-20 22:18:41

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: get active_class to work in with txp:category_list

Yes, that counts as a bug. Should be fixed in revision 2438

Offline

Board footer

Powered by FluxBB