Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2009-12-22 15:39:36
- s1deus
- Member
- From: New York
- Registered: 2005-04-06
- Posts: 30
Trouble showing articles from a specific section only without those in
Ok, so I am not a txp noob, but for some odd reason I am having trouble with this.
I am basically trying to display articles within a specific section AND category.
I tried several things, like:
<txp:if_individual_article>
<txp:article form="single" limit="1" pgonly="0" status="4" time="any" />
<txp:else />
<txp:article_custom allowoverride="0" form="article_listing" pgonly="0" section="about-us" category="about-us" status="live" />
<txp:if_category name="our-mission">
<txp:article_custom allowoverride="0" form="article_listing" pgonly="0" section="about-us" category="our-mission" sort="Posted desc" status="live" />
</txp:if_category>
</txp:if_individual_article>
In the section home, the content is displaying properly. In the categories page, ALL the content in the about us section is showing up. The url is index.php?s=about-us&c=our-mission
Why are all the articles in about us showing up under the category specific url?
I am also getting this error when I go to the category page:
Textpattern Notice: Page template section does not contain a txp:article tag on line 514
This is annoying as hell, especially when I have installed and configured txp a dozen times and have not had this issue before.
Thx.
Last edited by s1deus (2009-12-22 16:00:30)
Offline
#2 2009-12-22 17:18:23
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Trouble showing articles from a specific section only without those in
Try this:
<txp:if_individual_article>
<txp:article form="single" limit="1" time="any" />
<txp:else />
<txp:if_category name="our-mission">
<txp:article_custom form="article_listing" section="about-us" category="our-mission" />
<txp:else />
<txp:article_custom form="article_listing" section="about-us" category="about-us" />
</txp:if_category>
</txp:if_individual_article>
You can also replace the first article_custom tag with <txp:article form="article_listing" />
. Because <txp:article />
is context sensitive, on a page /?s=about-us&c=our-mission it will only display articles in that section and category.
You don’t need attributes if they contain the default value (allowoverride
, status
, pgonly
, sort
).
I am also getting this error when I go to the category page:
Textpattern Notice: Page template section does not contain a txp:article tag on line 514
It will disappear if you set Production status to ‘Live’. You can also prevent the notice by putting <txp:article limit="1" pgonly="1" />
somewhere on your page.
Offline
#3 2009-12-23 02:42:01
- s1deus
- Member
- From: New York
- Registered: 2005-04-06
- Posts: 30
Re: Trouble showing articles from a specific section only without those in
Hey thanks for the reply. I tweaked the code because I realized I have too many categories per section to write that script for every category. It all works.
Thanks again.
Offline
Re: Trouble showing articles from a specific section only without those in
Els wrote:
Try this:
<txp:if_individual_article>
<txp:article form="single" limit="1" time="any" />
<txp:else />
<txp:if_category name="our-mission">
<txp:article_custom form="article_listing" section="about-us" category="our-mission" />
<txp:else />
<txp:article_custom form="article_listing" section="about-us" category="about-us" />
</txp:if_category>
</txp:if_individual_article>
You can also replace the first article_custom tag with <txp:article form="article_listing" />
. Because <txp:article />
is context sensitive, on a page /?s=about-us&c=our-mission it will only display articles in that section and category.
You don’t need attributes if they contain the default value (allowoverride
, status
, pgonly
, sort
).
I am also getting this error when I go to the category page:
Textpattern Notice: Page template section does not contain a txp:article tag on line 514
It will disappear if you set Production status to ‘Live’. You can also prevent the notice by putting <txp:article limit="1" pgonly="1" />
somewhere on your page.
I have the same issue trying to separate section from category, but is seems that your code doesn’t work if section. What’s the syntax, then?
Thanks.
Offline
#5 2010-08-23 23:06:38
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Trouble showing articles from a specific section only without those in
Malize wrote:
I have the same issue trying to separate section from category, but is seems that your code doesn’t work if section. What’s the syntax, then?
I’m not sure I understand what you mean, can you explain what you want to do exactly? It should work in a similar way with if_section instead of if_category, but I don’t know if that is what you need.
Offline
Re: Trouble showing articles from a specific section only without those in
Thanks Els, although I finally discovered that you can put a single article tag in every section.
It’s awesome how this very simple things are so hard to find tutorials about, I read lots of them, and I swear I understood that single articles worked only in archives page :D
Offline