Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-09-02 21:11:08

lee
Member
From: Normandy, France
Registered: 2004-06-17
Posts: 831

List root categories?

Anyone know the TxP tag or plugin I need to list a linked list of root (no child) categories?

Best wishes
Lee

Last edited by lee (2008-09-02 21:11:24)

Offline

#2 2008-09-02 21:16:06

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

Re: List root categories?

Isn’t that one of the uses of smd_parent? Never really looked into it.


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

Offline

#3 2008-09-02 21:33:48

lee
Member
From: Normandy, France
Registered: 2004-06-17
Posts: 831

Re: List root categories?

Thanks, but it doesn’t give a linked list of categories, it returns the parent category of the current category.

Offline

#4 2008-09-02 21:35:31

lee
Member
From: Normandy, France
Registered: 2004-06-17
Posts: 831

Re: List root categories?

<txp:category_list /> is close but there is no way to restrict it to just root categories unfortunately.

Offline

#5 2008-09-03 04:48:22

rsilletti
Moderator
From: Spokane WA
Registered: 2004-04-28
Posts: 707

Re: List root categories?

Define “root” , I’m not sure TXP can see a difference. The parent/child relationship seems to be a relative thing, unless you are looking at category 1 vs. category 2 which are treated with equal status with the exception of the name.

Last edited by rsilletti (2008-09-03 04:50:34)

Offline

#6 2008-09-03 07:38:00

lee
Member
From: Normandy, France
Registered: 2004-06-17
Posts: 831

Re: List root categories?

By root I mean top level. It seems there is no core txp that returns a linked list of only top level categories. Categort_list returns top level categories and child categories – maybe in 4.07 this will change.

Offline

#7 2008-09-03 09:48:23

net-carver
Archived Plugin Author
Registered: 2006-03-08
Posts: 1,648

Re: List root categories?

Lee

If you just want the top level

SELECT * FROM `txp_category` WHERE `type`='article' AND `parent`='root';

should do it for articles. If you want links etc just change the type.

Perhaps you can use Stef’s smd_query(?) whatnot for this.


Steve

Offline

#8 2008-09-03 09:58:42

lee
Member
From: Normandy, France
Registered: 2004-06-17
Posts: 831

Re: List root categories?

Thanks Steve.

Offline

#9 2008-09-03 11:13:52

rsilletti
Moderator
From: Spokane WA
Registered: 2004-04-28
Posts: 707

Re: List root categories?

Hmm.. guess root means root. Not a bad idea for a feature, category list could possibly use a setting for this?

Offline

#10 2008-09-04 22:16:28

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

Re: List root categories?

Just came across ats_master_category_list =)


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

Offline

#11 2008-09-04 22:20:47

lee
Member
From: Normandy, France
Registered: 2004-06-17
Posts: 831

Re: List root categories?

I found that one as well, but it doesn’t output url’s as nicely as category_list. I’m holding out for a change to the tag.

Offline

#12 2008-09-05 01:08:48

rsilletti
Moderator
From: Spokane WA
Registered: 2004-04-28
Posts: 707

Re: List root categories?

So far this is testing perfectly for me, it’s an augmented category_list tag with an added “root” attribute that if set to 1 returns only the root categories. Does everything category_list does across types and I haven’t been able to break it yet. It’s not particularly hackish and if it tests well I’ll submit a patch for 4.0.7.

ras_category_list

First breakage – works only when the root attribute is set, back to the drawing board

ras_category_list_v4.0.6.1.txt better!

Feedback in this thread until it seems best to change it.

Last edited by rsilletti (2008-09-05 02:09:39)

Offline

Board footer

Powered by FluxBB