Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2015-01-08 11:17:16
- Gallex
- Member
- Registered: 2006-10-08
- Posts: 1,315
display sub-category list on sub-category page
hi,
this code below displays correctly sub-category list then i’m on a category page
<txp:if_section name='<txp:section />'>
<txp:if_category>
<txp:category_list wraptag="ul" break="li" section='<txp:section />' children="0" parent='<txp:category />' exclude='<txp:category />' sort="name asc" class="inline" />
</txp:if_category>
</txp:if_section>
i need that same sub-category list to show up on a sub-category page as well (after clicking ‘york’), but can’t figure out how. can you help me?
Offline
Re: display sub-category list on sub-category page
Could smd_parent be of help here? It allows you to retrieve the parent of the current category which you can then plug into parent
and exclude
attributes of category_list
. I can’t remember exactly what it does on the top-level category, but I’m guessing it returns the top-most category, which would mean it work on both category and sub-category pages.
TXP Builders – finely-crafted code, design and txp
Offline
#3 2015-01-09 10:54:38
- Gallex
- Member
- Registered: 2006-10-08
- Posts: 1,315
Re: display sub-category list on sub-category page
tried this way also, but nothing changed:
<txp:if_section name='<txp:section />'>
<txp:if_category>
<txp:category_list wraptag="ul" break="li" section='<txp:section />' children="1" parent='<txp:category />' exclude='<txp:category />' sort="name asc" class="inline">
<txp:category title="1" link="1" section='<txp:section />' />
</txp:category_list>
</txp:if_category>
</txp:if_section>
ok, i will try smd_parent
Offline
#4 2015-01-09 11:26:36
- Gallex
- Member
- Registered: 2006-10-08
- Posts: 1,315
Re: display sub-category list on sub-category page
brilliant! thank you jakob! final code:
<txp:if_section name='<txp:section />'>
<txp:if_category>
<txp:category_list wraptag="ul" break="li" section='<txp:section />' children="0" parent='<txp:smd_parent level="-1" />' exclude='<txp:smd_parent level="-1" />' sort="name asc" class="inline" />
</txp:if_category>
</txp:if_section>
Offline