Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2006-04-27 14:30:40
- msteinruck
- Member
- Registered: 2004-07-14
- Posts: 44
Display articles filtered by category
I have a link list of categories automatically generated using the <code><txp:stw_category_tree /></code> plugin. Here is an example of the type of URL string it produces: <code>http://www.mywebsite.com/category/Disaster-Relief/</code>
When I click on individual category links, I want only articles posted in those categories to display. I know that I could do this by writing individual article tags and conditional statements for every single category, but that doesn’t make sense. Is there a way to have TXP automatically filter the results for me to take some of the manual work out of it?
Thanks!
Offline
#2 2006-04-27 14:55:49
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Display articles filtered by category
<txp:article />
is context sensitive, meaning that it will only display articles from the section/category that is requested. So you shouldn’t need anything more than that.
Offline
#3 2006-04-27 15:00:11
- msteinruck
- Member
- Registered: 2004-07-14
- Posts: 44
Re: Display articles filtered by category
Okay I understand that Els and I tried it out. The problem is that for the front page of my site I have to use an article_custom tag so that I can filter the results, specifically by section. If I just make it an article tag, all of the posted articles will appear in my main column and I don’t want that. Does that make sense?
Offline
#4 2006-04-27 18:46:44
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: Display articles filtered by category
<txp:if_category>
<txp:article form="your_category_list_form" />
<txp:else />
<!-- you're not viewing a category list -->
<txp:article_custom form="your_frontpage_form" />
</txp:if_category>
:)
Offline
#5 2006-04-27 18:52:03
- msteinruck
- Member
- Registered: 2004-07-14
- Posts: 44
Re: Display articles filtered by category
Mary, you’re my hero!
Offline
Re: Display articles filtered by category
isn’t she though :)
- I am Squared Eye and I
am launchinghave launched Pattern Tap
Offline
#7 2006-05-04 09:11:53
- JohnR
- New Member
- Registered: 2004-07-03
- Posts: 4
Re: Display articles filtered by category
Thanks for that Mary :)
How can I display the same list when looking at an actual article: that is. all articles in the same category? txp:related_articles is close but leaves out the current article :(
JohnR
Offline
#8 2006-05-04 10:27:04
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: Display articles filtered by category
Do they need to also be in the same section, or just across the board?
Offline
#9 2006-05-04 12:07:35
- JohnR
- New Member
- Registered: 2004-07-03
- Posts: 4
Re: Display articles filtered by category
Mary wrote:
Do they need to also be in the same section, or just across the board?
I don’t know… I think in the same section? Either would probably be fine since I’m not using sections yet (that I know of)
Offline
Pages: 1