Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2010-11-21 16:10:01
- snthr
- Member
- Registered: 2007-07-13
- Posts: 42
nested category/subcategory lists
hi. how do i get a category list to output in a <ul> with this sort of logic to it?
> category
>> subcategory
>> subcategory
> category
> category
>> subcategory
etc.
thanks.
Last edited by snthr (2010-11-21 16:11:30)
Offline
#2 2010-11-21 16:22:31
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: nested category/subcategory lists
Something like this?
<txp:category_list wraptag="ul" break="li" children="0">
<txp:category title="1" />
<txp:category_list parent='<txp:category />' exclude='<txp:category />' wraptag="ul" break="li">
<txp:category title="1" link="1" />
</txp:category_list>
</txp:category_list>
Offline
#3 2010-11-21 16:41:41
- snthr
- Member
- Registered: 2007-07-13
- Posts: 42
Re: nested category/subcategory lists
thanks for that. the problem here is that the client i’m working for will be adding new categories and subcategories as he adds more content, and i need the category list to be able to auto-populate based on his additions.
Offline
#4 2010-11-21 18:59:08
- redbot
- Plugin Author
- Registered: 2006-02-14
- Posts: 1,410
Re: nested category/subcategory lists
snthr wrote:
…and i need the category list to be able to auto-populate based on his additions.
I’m missing something? doesen’t Els code do just this?
Offline
#5 2010-11-22 01:47:29
- snthr
- Member
- Registered: 2007-07-13
- Posts: 42
Re: nested category/subcategory lists
sorry, i read it wrong. thanks els!
Offline
#6 2014-02-25 13:34:25
- Gallex
- Member
- Registered: 2006-10-08
- Posts: 1,315
Re: nested category/subcategory lists
Els wrote #237596:
Something like this?
<txp:category_list wraptag="ul" break="li" children="0">...
is it possible to include frontpage link into this code?
Offline
#7 2014-02-25 14:02:19
- Gallex
- Member
- Registered: 2006-10-08
- Posts: 1,315
Re: nested category/subcategory lists
Els wrote #237596:
Something like this?
<txp:category_list wraptag="ul" break="li" children="0">...
and one more thing: display all articles (sorted by sub-categories) under this parent category then parent category link is clicked. possible?
Offline
#8 2014-02-25 21:04:47
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: nested category/subcategory lists
Gallex wrote #279229:
is it possible to include frontpage link into this code?
Sure:
<ul>
<li><txp:link_to_home>home</txp:link_to_home></li>
<txp:category_list break="li" children="0">
<txp:category link="1" title="1" />
<txp:category_list parent='<txp:category />' exclude='<txp:category />' wraptag="ul" break="li">
<txp:category title="1" link="1" />
</txp:category_list>
</txp:category_list>
</ul>
Gallex wrote #279230:
and one more thing: display all articles (sorted by sub-categories) under this parent category then parent category link is clicked. possible?
Yes, you can place this code on your page:
<txp:category_list parent='<txp:category />' exclude='<txp:category />'>
<h3><txp:category title="1" /></h3>
<txp:article_custom category='<txp:category />' wraptag="ul" break="li">
<txp:permlink><txp:title /></txp:permlink>
</txp:article_custom>
</txp:category_list>
But this doesn’t work too well on a child category page. Do the child categories in the menu need to be hyperlinked? In that case the code will need some modification.
Offline
#9 2014-02-26 08:35:43
- Gallex
- Member
- Registered: 2006-10-08
- Posts: 1,315
Re: nested category/subcategory lists
Els wrote #279266:
But this doesn’t work too well on a child category page. Do the child categories in the menu need to be hyperlinked? In that case the code will need some modification.
yes, i ment to put those two request into one code
EDIT: els, let it be, i decided to create it differently. i start a new topic.
Last edited by Gallex (2014-02-26 09:40:52)
Offline
Pages: 1