Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2013-02-15 13:29:15
- lonelytraveller
- Member
- From: Firenze, Italy
- Registered: 2008-04-04
- Posts: 45
category_name and sticky articles
I’m working on a website where a “Press” section is needed. I’m on TXP 4.5.2 and I’m using the latest version of MLP plug-in.
Inside my Press section I’m using a category (name: press-clippings) to separate press-clippings (pretty obvious!) from the rest of the press stuff (articles, releases, images for journalists, etc.). Als all the articles in the “press-clippings” category have a “sticky” status.
Of course I need to show everything on separate pages: so far so good. In my “press” template I’m using the following code:
<!-- Display all the "live" articles on the main press page -->
<txp:article form="press_single" status="live" listform="press_list" pgonly="0" />
<!-- When on "press-clippings" category page display only sticky articles from that category -->
<txp:if_category name="rassegna-stampa">
<txp:article form="clippings_single" status="sticky" listform="clippings_list" pgonly="0" />
</txp:if_category>
<txp:if_individual_article>
<h6>##attached_files##</h6>
<txp:file_download form="press_files" id='<txp:custom_field name="files" />' />
</txp:if_individual_article>
Everything looks fine on the category page: all articles are retrieved. But the single “clipping” article doesn’t show up, even if the link for the downloadable file is shown. If I look at the tag trace in Debug mode I can see that the category is ignored: <txp:if_category name="rassegna-stampa"> [<txp:if_category name="rassegna-stampa">: false]
In other words everything in the page template is parsed correctly, the article is retrieved and the link to the file is displayed. On the other hand everything in the clippings-single module si ignored, since the if_category conditional is ignored. And – correct me if I’m wrong – since the article doesn’t have a “live” status it is not displayed by the press_single module either.
I thought this could be because I’m using clean URLs (section/title/) and in this case the category is not in the URL but if I switch to messy nothing changes.
Any suggestions? Maybe I’m just using the wrong approach to retrieve articles from the paper-clippings category?
Offline
Re: category_name and sticky articles
Hi Caterina,
<txp:if_category />
is false unless you have set c=some_cat
in url string, which is (normally) not the case on individual article pages. Try to modify it like this:
<!-- Display all the "live" articles on the main press page -->
<txp:article form="press_single" status="live" listform="press_list" pgonly="0" />
<txp:if_individual_article>
<!-- When on "press-clippings" category article display only sticky articles from that category -->
<txp:if_article_category name="rassegna-stampa">
<txp:article form="clippings_single" status="sticky" pgonly="0" />
</txp:if_article_category>
<h6>##attached_files##</h6>
<txp:file_download form="press_files" id='<txp:custom_field name="files" />' />
<txp:else />
<!-- When on "press-clippings" category page display only sticky articles from that category -->
<txp:if_category name="rassegna-stampa">
<txp:article form="clippings_single" status="sticky" listform="clippings_list" pgonly="0" />
</txp:if_category>
</txp:if_individual_article>
Offline
#3 2013-02-15 14:33:24
- lonelytraveller
- Member
- From: Firenze, Italy
- Registered: 2008-04-04
- Posts: 45
Re: category_name and sticky articles
I can’t believe how dumb I can be… of course <txp:if_category >
is the wrong tag, I should have used <txp:if_article_category>
to check if the individual article is in the paper-clippings category.
Offline
Pages: 1