Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-06-02 15:50:59

floodfish
Member
From: Brooklyn, NY
Registered: 2007-01-11
Posts: 155
Website

items related by category and category archive

First off, I am using rss_unlimited_categories (0.7.4p6) and Textpattern 4.0.8 (r3085)

Two (presumably) related problems:

1) On an article page, I want to bring up a list of other articles related by category. I want the category name to show up, followed by the articles that share that category with the current one. Then the next category, followed by its articles, etc. Using rss_unlimited_categories_related brings up a bunch of articles but with no indication of what category they share with the current article. I’d also like to be able to specify parent categories to pull related content from (or to ignore). Perhaps I am assuming core functionality that isn’t really there, or perhaps I’m using the wrong tags/code. (I played around with the built-in category 1 and 2 and txp:related_articles and have the same problem, so I think this is not only a problem with rss_unlimited_categories.)

2) I want an archive list of articles sorted by category, with the category name followed by all articles in that category, followed by the next category, etc. I have a similar problem to 1) above—articles show up, but no indication of grouping by category. I need the name of a category, followed by appropriate articles in that category, then the name of the next category, etc. Should I be using if_different? should I be using txp:category ?

Thanks!

Offline

#2 2009-06-02 18:18:42

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

Re: items related by category and category archive

I don’t know the plugin, can’t help you with that, but to display a list of articles grouped by category (or by whatever) you need <txp:if_different>. At the bottom of the Textbook page you’ll find an example how to group by section, it’s easy to adapt the code for categories.

Offline

#3 2009-06-06 06:33:45

floodfish
Member
From: Brooklyn, NY
Registered: 2007-01-11
Posts: 155
Website

Re: items related by category and category archive

If anyone’s wondering, I was able to more or less achieve my goals via the wonderful adi_cat_menu and a hack of rss_unlimited_categories to make it return category names instead of titles.

(As far as I can tell, rss_unlimited_categories can’t handle txp:if_different and/or txp:category in the ways that it should for what I’m trying to do.)

Offline

#4 2009-06-06 07:09:31

jpdupont
Member
Registered: 2004-10-01
Posts: 752

Re: items related by category and category archive

I don’t know if this code may be usefull for you (to get category name, not title).
I use this (category_list as container tag) with adi_cat_menu :

<txp:adi_cat_menu article_attr='sort="title asc"' this_section="1" section_sensitive="1" link="0" categories='<txp:category_list parent="9-cours" exclude="9-cours" wraptag="" break=","><txp:category /></txp:category_list>' />

Offline

#5 2009-06-07 04:57:31

floodfish
Member
From: Brooklyn, NY
Registered: 2007-01-11
Posts: 155
Website

Re: items related by category and category archive

Oh, nice trick!

Offline

Board footer

Powered by FluxBB