Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2009-04-29 20:04:22
- woy
- Member
- Registered: 2009-04-08
- Posts: 18
Problem with nested conditionals
Thanks to Els’ and others support a small project is nearing completion and I hope this is the my last post regarding it.
After trying around for several hours without any progress I hope that someone has an idea how to solve this issue.
I generate a combined category/article-list, nesting <ul>-elements for categories and articles.
<li<txp:if_individual_article>
<txp:if_article_category name='<txp:category />'>
class="active"
</txp:if_article_category>
<txp:else />
<txp:if_category name='<txp:category />'> class="active"
<txp:else />
<txp:if_section>
<txp:variable name="sticky_article_category" value='<txp:article status="sticky" limit="1"><txp:category1 /></txp:article>' />
<txp:if_variable name="sticky_article_category" value='<txp:category />'> class="active"
</txp:if_variable>
</txp:if_section>
</txp:if_category>
</txp:if_individual_article>>
<txp:category link="1" title="1" />
</li>
<txp:output_form form="content_nav" />
This is my content_nav-form. My problem is located in the second part of this form. When I navigate to an article, I get my article-list according to the current category, but repeated after every <li> generated by the upper form. In the first part of the follwing snippet I added <txp:article_custom category='<txp:category />'
which displays my article list only when the correct category is selected. But unfortunately the <txp:if_individual_article>
tag doesn’t support something similar to <txp:if_category name='<txp:category />'>
. Does anyone have an idea how to fix that?
<txp:if_category name='<txp:category />'>
<txp:article_custom category='<txp:category />' form="content_link" wraptag="ul" class="content_nav" status="" />
</txp:if_category>
<txp:if_individual_article>
<txp:article_custom category='<txp:category1 />' form="content_link" wraptag="ul" class="content_nav" />
</txp:if_individual_article>
Thanks and best wishes, Sebastian
Offline
#2 2009-04-29 21:03:17
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Problem with nested conditionals
Did I overlook that in your other thread? My apologies!
You need to tell Txp to display the articles only when the current article’s category matches the category in the list. Try if this works:
<txp:if_individual_article>
<txp:if_article_category name='<txp:category />'>
<txp:article_custom category='<txp:category1 />' form="content_link" wraptag="ul" class="content_nav" />
</txp:if_article_category>
</txp:if_individual_article>
Offline
#3 2009-04-29 21:55:46
- woy
- Member
- Registered: 2009-04-08
- Posts: 18
Re: Problem with nested conditionals
Hi, Els! No, you didn’t overlook it. This problem occured just after restructuring my navigation.
Once again, it works perfectly. Completely overlooked txp:if_article_category
which was exactly what I was looking for.
Thank you once again,
Sebastian
Offline
Pages: 1