Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
outputing ONLY articles belonging to a particular category
Hi Please forgive my ignorance, im a txp noob.
*I would like to out ONLY certain articles belonging to a particular category e.g “MyNews”. *
I then want to place this in a custom form:-
<txp:article_custom limit=3 form=“MyNews_Articles” />
I looked for over an hour and haven’t found any answers, im sure this must have been asked before but I can’t find any references can someone point me inthe right direction please.
Many thx
Timid
I think, therefore I AM, … … er … I think :-?
Offline
Re: outputing ONLY articles belonging to a particular category
If I understood corretly, it would be simple, just add a category="category name"
to inside the <txp:article_custom />
-tag. Like this, in your case:
<txp:article_custom limit="3" form="MyNews_Articles" category="MyNews" />
Last edited by Gocom (2007-07-12 22:28:59)
Offline
Re: outputing ONLY articles belonging to a particular category
Thx that worked a treat and easy too!
One more question…. On the main page I DON’T want to show This specific category.
How would i exclude it from the output of that part of the site, as I only ant to show “MyNews” in a my news article_custom section.
I think, therefore I AM, … … er … I think :-?
Offline
Re: outputing ONLY articles belonging to a particular category
If I again understood correctly, you want to show articles only in *news*-section? So, then you have to add there <txp:if_section name="section name" />
-tags, like this:
<txp:if_section name="news">
<txp:article_custom limit="3" form="MyNews_Articles" category="MyNews" />
</txp:if_section>
Last edited by Gocom (2007-07-13 07:45:47)
Offline
Re: outputing ONLY articles belonging to a particular category
I apologise for my lack of clarity, i’ll try to elaborate
The default page has two area’s where articles are output;
1. the standard way where all article of every category are shown.
2. and <txp:article_custom limit=“3” form=“MyNews_Articles” category=“MyNews” /> ONLY news articles.
However i would like to exclude [category=“MyNews”] from de default standard output area. (i’m not using sections yet.)
How could i do this
I think, therefore I AM, … … er … I think :-?
Offline
Re: outputing ONLY articles belonging to a particular category
So you don’t want to show that <txp:article_custom />
on frontpage, but in anywhere else? Or you just want to show it when you are browsing category="MyNews"
? Or you want to show it when reading an single article? Sorry, I’m little confused, somehow I just don’t understand what you’re saing. But a matter what, here’s answers:
If you want to show it elsewhere than frontpage ( you need to download and innstall plugin named glx_if ):
<txp:glx_if_not_frontpage>
<txp:article_custom limit="3" form="MyNews_Articles" category="MyNews" />
</txp:glx_if_not_frontpage>
If you want to show it when browsing current category:
<txp:if_category name="MyNews">
<txp:article_custom limit="3" form="MyNews_Articles" category="MyNews" />
</txp:if_category>
Or if you want to show it when you’re only reading single article:
<txp:if_individual_article>
<txp:article_custom limit="3" form="MyNews_Articles" category="MyNews" />
</txp:if_individual_article>
Or you can use in those <txp:else />
-tag, that you can output the default article outputting style, and those two won’t come up in same time. I hope there is something that helps you, if not, just explain more, and I (or someone else) will get back in to your problem :-)
And url, or example-code of your case would be nice :-)
Last edited by Gocom (2007-07-13 08:56:59)
Offline
Re: outputing ONLY articles belonging to a particular category
Some great tips, but unfortunately not what i meant,
I’ve included a link to a screendump of what i am trying to achieve:-
http://idisk.pixeloid.co.uk/txp-categories.jpg
This is all happening on the default page. I am not using sections
The site is at:-
http://meanttoshine.org/weblog
Thx again for your time
Last edited by Timid&friendly (2007-07-13 09:23:13)
I think, therefore I AM, … … er … I think :-?
Offline
Re: outputing ONLY articles belonging to a particular category
Oh, it was that simple problem, my bad. Or it’s simple if you need only some particular categories. You just use absolutely same code that before, but list categories comma seperated, like this:
<txp:if_individual_article>
<txp:article />
<txp:else />
<txp:article_custom limit="5" form="default" category="other,casual,food" />
</txp:if_individual_article>
And replace with it the default <txp:article />
-tag. Have fun with it :-)
Last edited by Gocom (2007-07-13 10:42:14)
Offline
Re: outputing ONLY articles belonging to a particular category
that seems to do the trick, THX.
So there is No “!NOT” function in txp
as in if (!category name=“MyNews”) { statement; }
Last edited by Timid&friendly (2007-07-13 12:16:53)
I think, therefore I AM, … … er … I think :-?
Offline
Offline
Re: outputing ONLY articles belonging to a particular category
Timid&friendly wrote:
that seems to do the trick, THX.
So there is No “!NOT” function in txp
as in if (!category name=“MyNews”) { statement; }
…or you could have easily used sections
Offline
Offline