Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-08-19 17:59:38

nabrown78
Member
From: Northampton, MA, USA
Registered: 2006-10-04
Posts: 294
Website

How to list links in child categories?

Geez, I’m feeling TXP-clueless today I guess.

What I’d like to do is output a simple list of links. I have a general category set up (“Elsewhere”) as a parent category, and a few child categories, such as “Food” and “Wine”. I set it up this way because I want my client to be able to add child categories, and have them appear in the link list, which I was trying to output with:

<txp:linklist form="Links" category="Elsewhere" limit="12" sort="linksort" />

But I suppose because the parent category doesn’t itself contain any links, that outputs nothing. Is there a way to force <txp:linklist /> to output links in child categories?

Thanks in advance.

Offline

#2 2009-08-19 19:20:41

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,306

Re: How to list links in child categories?

Does this get you any further:

<txp:linklist form="Links" limit="12" sort="linksort" category='<txp:category_list type="link" exclude="cat1" break=","><txp:category /></txp:category_list>' />
(not yet tested)

Have a look at the exclude and category attributes of category_list.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#3 2009-08-19 19:31:16

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

Re: How to list links in child categories?

Nora, here is a TXP Tip that does about the same thing for files. I think you can easily modify that code to work with links.

Oh, and don’t use capitals in category names (category="Elsewhere").

Last edited by els (2009-08-19 19:35:53)

Offline

#4 2009-08-19 20:59:50

nabrown78
Member
From: Northampton, MA, USA
Registered: 2006-10-04
Posts: 294
Website

Re: How to list links in child categories?

Of course! TXP tags as attributes are so money! Here’s what I ended up with:

<txp:linklist form="Links" limit="12" category='<txp:category_list type="link" parent="elsewhere" break="," ><txp:category title="0" /></txp:category_list>' sort="linksort" />

Thanks folks.

Offline

Board footer

Powered by FluxBB