Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Exclude Categories in Article Listing
I know it’s been asked a million times on the forum already, but as of yet, I can’t find any solutions. I’m trying to make an archive page that lists things by section / category. However, since Textpattern does not allow for a category to be selected by default when on the content > write area, like it can be done with a section, I’m at a loss. I want to output a list of all articles that have no category assigned to them. Here is the URL in question:
http://godbit.com/archive_topics/
Below is the code I’m using…
<div id="content">
<h1>Topical Overview</h1>
<h2>Book Reviews</h2>
<ul>
<txp:article_custom limit="999" form="topical" section="article" category="book" sortby="title" sortdir="asc" />
</ul>
<h2 class="overline">Featured Sites</h2>
<ul>
<txp:article_custom limit="999" form="topical" section="featured" sortby="title" sortdir="asc" />
</ul>
<h2 class="overline">General</h2>
<ul>
<txp:article_custom limit="999" form="topical" section="article" category="general" sortby="title" sortdir="asc" />
</ul>
<h2 class="overline">Interviews</h2>
<ul>
<txp:article_custom limit="999" form="topical" section="article" category="interview" sortby="title" sortdir="asc" />
</ul>
<h2 class="overline">Tutorials</h2>
<ul>
<txp:article_custom limit="999" form="topical" section="article" category="tutorial" sortby="title" sortdir="asc" />
</ul>
</div>
<br />
—› So, if anyone knows of a way to do something to the effect of category!=="book,interview,tutorial"
– I’d really appreciate it.
Last edited by Nathan Smith (2006-01-18 16:20:20)
Are we all figments of God’s imagination?
Offline
Re: Exclude Categories in Article Listing
I’m no expert in this, but I wonder if the <code></txp:if_article_category></code> might take a “” parameter for the category name?
Haven’t tried it, but the syntax is here
Yours in inexperience…
Last edited by NeilA (2006-01-16 20:42:35)
Offline
Re: Exclude Categories in Article Listing
I tried outputting “” with the article_custom tag, but unfortunately that means “everything.” Alternatively, does anyone know how to force one category to always be selected? (If it involved hacking TXP, that’s fine, I’m just not sure where to look).
Are we all figments of God’s imagination?
Offline
#4 2006-01-18 07:40:34
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Exclude Categories in Article Listing
Maybe something like this?
<code>
<txp:if_category name=”“>
<txp:else />
article tag
</txp:if_category>
</code>
You can set a default value for fields in the database through phpMyAdmin (go to the textpattern table, structure, edit the field category1 and/or category2).
Offline
Re: Exclude Categories in Article Listing
Well, no dice. I finally just went back through and made a “General” category, and re-posted all the uncategorized articles there, to be able to output them in a list. Hopefully people’s RSS didn’t go crazy. :)
Are we all figments of God’s imagination?
Offline
Pages: 1