Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2006-09-14 11:14:47
- Thirteen
- Member
- Registered: 2006-01-09
- Posts: 40
"List all but NOT..." sections or categories?
I’ve been searching and failing to find anything about this, so I really really hope someone can help me out. I was wondering if there was a way to make articles display by using an “all except this section/category” sorting? I know we can specify a list of categories separated by commas, but that seems to be a major hassle if you intend to add on a lot of categories as you go. Then everytime you add a category, you’d have to go and add it in to all the places where you have the articles sorted specifically.
All I really want to do is EXCLUDE one category from being displayed in my list of latest entries. It will always be this one category that I do not want to show. Is there a way for me to just easily sort by telling the list to display everything in said section except for one specific category?
Offline
Re: "List all but NOT..." sections or categories?
You could create a section for that category which has the “On front page?” set to “no”
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: "List all but NOT..." sections or categories?
<code><txp:if_category name=“name_of_category_to_be_left_out”>…just leave empty…
<txp:else />
<txp:article />
</txp:if_category>
</code>
k?
Last edited by jayrope (2006-09-14 20:51:35)
A hole turned upside down is a dome, when there’s also gravity.
Offline
#4 2006-09-15 15:26:44
- Thirteen
- Member
- Registered: 2006-01-09
- Posts: 40
Re: "List all but NOT..." sections or categories?
Thanks for both of your help. I did think about creating a new section for it, but it seems “too much” to create a whole separate section for one category that should be grouped under the other section, except for the fact that I didn’t want it to show on my article list of the main page. After some more fiddling and giving up, I did end up creating another section as it seems to be the only way at this moment.
@Jayrope: Thank you for the suggestion, though that doesn’t quite work. I already have the if_category tag on my default page…which is used for when a category listing is called. I do want to display a list of articles for this category. I only didn’t want it to be included on my main page by default. :(
Offline
Re: "List all but NOT..." sections or categories?
13, i think it isn’t a problem to use the if_category tag more than just once.
at least i do that here.
Last edited by jayrope (2006-09-15 18:37:33)
A hole turned upside down is a dome, when there’s also gravity.
Offline
#6 2006-09-15 21:19:22
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: "List all but NOT..." sections or categories?
An aside: yes, you can use if_category more than once. The only limitation is that the same tags cannot contain themselves, i.e, you can’t do: <txp:if_category><txp:if_category></txp:if_category></txp:if_category>. I believe the intent is that this will be fixed at some future point.
But, as Thirteen points out, that means having content on his category page that he doesn’t want, and not on his home page where he wants it.
Offline
#7 2006-09-15 22:17:59
- els
- Moderator

- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: "List all but NOT..." sections or categories?
Thirteen wrote:
All I really want to do is EXCLUDE one category from being displayed in my list of latest entries.
In your article list form:
<txp:if_article_category name="name_of_category_to_be_left_out">
<txp:else />
your form's regular content
</txp:if_article_category>
Offline
Re: "List all but NOT..." sections or categories?
FYI, this has been answered in <a href=“http://textpattern.com/faq/184/how-do-i-do-ifnotsomething”>the FAQ</a>.
Offline