Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-04-02 10:23:57

K2member
Member
Registered: 2006-10-24
Posts: 19

Highlight category in sidebar if category or article in categoy active

Hi.
In my navigation I’ve got a custom list of categories:

<ul> <li><txp:category link=“1” title=“1” name=“category1” /></li> <li><txp:category link=“1” title=“1” name=“category2” /></li> <li><txp:category link=“1” title=“1” name=“category3” /></li>
</ul>

Now I want to show a “>” in front of the category-link if either the category itself or an article in it is opened.
I tried this (for each category):

<txp:if_category name=“category1”> &rsaquo;
<txp:else />
<txp:if_article_category name=“category1”> &rsaquo; </txp:if_article_category>
</if_category>

But of course this produces an error since the if_article_category is executed for the two other categories.

Offline

#2 2009-04-02 10:56:10

the_ghost
Plugin Author
From: Minsk, The Republic of Belarus
Registered: 2007-07-26
Posts: 907
Website

Re: Highlight category in sidebar if category or article in categoy active

Here is mine code:

<txp:category_list break="" wraptag="ul" parent="article" exclude="article" form="category_list" />

Form category_list:

<li
<txp:if_article_list>
  <txp:if_category name='<txp:category />'>
    class="active"
  </txp:if_category>
<txp:else />
  <txp:if_article_category name='<txp:category />'>
    class="active"
  </txp:if_article_category>
</txp:if_article_list>
>
<txp:category name='<txp:category />' this_section="0" section="" link="1" title="1" />
</li>

This examples marks li both in article_list and individual_article cases.


Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?

Offline

#3 2009-04-02 11:12:07

K2member
Member
Registered: 2006-10-24
Posts: 19

Re: Highlight category in sidebar if category or article in categoy active

Thank you, I used your conditionals and it works just fine.

Offline

Board footer

Powered by FluxBB