Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-08-30 11:54:19

bnetz
Member
Registered: 2009-07-17
Posts: 11

Article-List: How to exclude 2 _categories_?

hi,

on my frontpage i show all existing articles as a list with this tag:

<txp:article form="article_listing" limit="9999" sort="Posted desc" />

some articles are assigned to a category, let’s say the categories test1, test2, test3, test4.

in the tag above i want to exclude all articles that are assigned to test1 and test3. is this possible?

thanks in advance!

Last edited by bnetz (2009-08-30 11:54:43)

Offline

#2 2009-08-30 12:09:21

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,091
Website GitHub Mastodon Twitter

Re: Article-List: How to exclude 2 _categories_?

The easiest way is to create a new section which does not show its articles on the front page. Alternatively you can use the “glx_if” plugin and do something like

<txp:glx_if_frontpage>
<txp:article_custom category="test2,test4" limit="5' />
<a href="<txp:site_url />index.php?pg=2">Older</a>
<txp:else />
<txp:article limit="5" offset="5" />
</txp:glx_if_frontpage>

Note that pagination does not work with article_custom so a had coded link to pg 2 should be included


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#3 2009-08-31 06:19:33

bnetz
Member
Registered: 2009-07-17
Posts: 11

Re: Article-List: How to exclude 2 _categories_?

thanks for the fast answer. the glx_if-plugin right is not available from the ressource-page
anyway i assume the glx-variant won’t work with me, because a lot of entries are not assigned to a category. the easiest for me would be just to exclude some categories, but i don’t know if this could work.

so i did it with the sections, due to your advice, this is a good solution. thanks again!

Offline

#4 2009-08-31 07:36:19

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,091
Website GitHub Mastodon Twitter

Re: Article-List: How to exclude 2 _categories_?

bnetz wrote:

thanks for the fast answer. the glx_if-plugin right is not available from the ressource-page

THere is also soo_if_frontpage if I remember correctly which does the same job


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#5 2009-08-31 11:05:12

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: Article-List: How to exclude 2 _categories_?

bnetz wrote:

the easiest for me would be just to exclude some categories, but i don’t know if this could work.

Like this?


Code is topiary

Offline

#6 2009-08-31 15:25:05

bnetz
Member
Registered: 2009-07-17
Posts: 11

Re: Article-List: How to exclude 2 _categories_?

very nice idea, but to be honest: doesn’t work for me, because some entries are not assigned to a category. otherwise it should work like a charm :-)

Offline

#7 2009-08-31 16:20:36

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: Article-List: How to exclude 2 _categories_?

bnetz wrote:

very nice idea, but to be honest: doesn’t work for me, because some entries are not assigned to a category. otherwise it should work like a charm :-)

OK, now I understand. Since you aren’t concerned about limit, you could use if_article_category in the article form to suppress output for the forbidden categories.


Code is topiary

Offline

#8 2009-08-31 20:10:13

bnetz
Member
Registered: 2009-07-17
Posts: 11

Re: Article-List: How to exclude 2 _categories_?

this maybe possible, but i am pretty new to tp and don’t know how to realize it with this tag. perhaps someone could help me out with a quick hint? thanks in advance …

Offline

#9 2009-08-31 20:17:40

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: Article-List: How to exclude 2 _categories_?

bnetz wrote:

this maybe possible, but i am pretty new to tp and don’t know how to realize it with this tag. perhaps someone could help me out with a quick hint? thanks in advance …

Use the article tag you used in your original post.

Use this for the form article_listing:

<txp:if_article_category name="exclude1,exclude2"><txp:else />
... output tags go here ...
</txp:if_article_category>

I haven’t tested this…

Last edited by jsoo (2009-08-31 20:18:18)


Code is topiary

Offline

#10 2009-09-02 07:50:20

bnetz
Member
Registered: 2009-07-17
Posts: 11

Re: Article-List: How to exclude 2 _categories_?

hm, sorry, i can’t bring this to life:

<txp:if_article_category name="category-name"><txp:else />
	<txp:article form="article_listing" limit="9999" sort="Posted desc" />
</txp:if_article_category>

so still all articles are shown in the list … i feel the exclude-tag should be positioned INSIDE the txp:article-tag, but how? :-)

Offline

#11 2009-09-02 08:18:50

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,091
Website GitHub Mastodon Twitter

Re: Article-List: How to exclude 2 _categories_?

the txp:article tag has no exclude attribute. Is there a reason you don’t want to create a new section for those articles?


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#12 2009-09-02 08:36:37

bnetz
Member
Registered: 2009-07-17
Posts: 11

Re: Article-List: How to exclude 2 _categories_?

yes: all my entries are assigned to a section, let’s say “mysql”, “php” and “html”.
some entries are assigned to a category like “ideas”, “tricks” and so on. but i don’t want to show “ideas” in the list on the frontpage.

so if i would create a new section for the articles i don’t want in the list, they would be either redundant (“mysql-ideas”) or it would result in a chaotic structure (“ideas”, there ideas to mysql, php etc.).

it’s not vital for me to use the txp:article-tag. i just want to show a list of all articles on my front-page, and the txp:articles-tag was the one which made the race (cf. this thread)

Offline

Board footer

Powered by FluxBB