Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Strange behavior with txp:article on individual "Sticky" article URLs
Hi,
I just wanted to report this strange behavior I found using Textpattern v4.5.7.
I have a template like this:
<txp:if_article_list>
<!-- Display some stuff. -->
<txp:else/>
<!--
This is the individual article page.
Show individual article content.
-->
<txp:article form="_static"/>
</txp:if_article_list>
For most sections that use this, I only ever need to display articles with “Live” status, but on one I need to display an individual “Sticky” article.
But when I visit the Sticky article’s individual URL, the article form returns nothing. It doesn’t pull a 404 error, it just displays everything before and after the article form content.
So I changed the article tag to this:
<txp:article
form="_static"
status="live,sticky"
/>
This produced the same results: Everything shows up except the article form content.
Strangely, if I replace the article tag with this, it produces the exact results I wanted:
<txp:article_custom
form="_static"
id='<txp:article_id/>'
/>
The article ID is populated because we are viewing an individual article URL. I have no idea why this works and the previous article tag doesn’t.
I don’t need a solution, since I developed a workaround, but I was surprised to discover this.
Are these outputs intended? Or is this a bug?
Thanks!
Last edited by johnstephens (2016-02-03 23:06:11)
Offline
Re: Strange behavior with txp:article on individual "Sticky" article URLs
P.S. The only drawback of using article_custom in this way is that it requires an extra tag to avoid an error message, like so:
<txp:article pgonly="1"/>
Offline
Re: Strange behavior with txp:article on individual "Sticky" article URLs
IIRC, the way to show a sticky or a live article is to do:
<txp:article form="_static" status="sticky" />
<txp:article form="_static" status="live" />
And either one or the other cuts in depending on the situation. I don’t think the status
attribute supports dual options any more, just live or sticky with live as default.
TXP Builders – finely-crafted code, design and txp
Offline
Re: Strange behavior with txp:article on individual "Sticky" article URLs
Thank you, @jakob! Yes, that pattern seems familiar from previous use. Do you know if doing this hits the database with two queries instead of one?
Offline