Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
"sticky" article kept in context of a "live" article list, how?
The scenario:
- Want a single article to represent the default content when a section link is clicked. (hence, the sticky article)
- The article will actually be one of a series of articles that should appear in a side column list in that section, including the default (sticky) article. As any article in the series it clicked, it swaps the place of the default article in the main view.
- When
/section/titleURLs are used, the default (sticky) article should have a URL macthing that, not reduced to just/section(the default link for the section).
Here’s what I’ve started with which seems logical…
<txp:if_article_list>
<txp:article form="Single" status="sticky" />
<txp:else />
<txp:article form="Single" limit="1" />
</txp:if_article_list>
This works except the sticky article disappears from the side column list. (I realize that’s probably what it’s supposed to do, but that’s actually not what I want in this case.)
So then I tried adding the sticky in the side column list as a single entry on top of the live list items (note the first tag entry)…
<ul><txp:article_custom form="Single" category="Stuff" sortdir="asc" listform="lstStuff" status="sticky" />
<txp:article_custom form="Single" category="Stuff" sortdir="asc" listform="lstStuff" /></ul>
…this made the side column series look as expected by including the default (sticky) article as the first article in the series (as wanted), but when the title link is clicked, it returns a blank article in the main view. Dang!
Realizing the sticky status is being filtered away from the other live status articles one way or the other, I decided to use Yuri’s great ied_doarticle plugin to add the default article in the original conditional instead of using status sticky and change the desired default article back to a status of “live” so it would appear as desired in the column list (note it requires two plugin tags to get both the title and the article body)…
<txp:if_article_list>
<txp:ied_doArticle id="##" textile="y" field="Title" />
<txp:ied_doArticle id="##" textile="y" />
<txp:else />
<txp:article form="Single" limit="1" />
</txp:if_article_list>
This works and is what I will probably use unless I figure some other logic out.
Ideally I would like to use the sticky status for the desired default article and have it show up no problem in the side column list with the other live status articles. Something like <code>status=“sticky,live”</code>, but I doubt that’s an easy thing to support in the core.
Another problem, though, with the sticky approach is that the URL is fixed to appear without the articles title (i.e., only as <code>/section</code>). That’s fine — and desired — when people are coming in from the main navigation, but it’s not a desired appearance when the link is viewed as an item in the column list, where a user would expect to see the <code>/section/title</code> format, particularly if they were looking to bookmark the article.
<hr>
@Yuri: Is is possible to call multiple article pieces from one instance of the ied_doArticle tag? I tried <code>field=“Title,Body”</code> but it didn’t work. That would be a nice enhancement.
Last edited by Destry (2006-09-18 16:47:35)
Offline
Re: "sticky" article kept in context of a "live" article list, how?
Hi Destry,
you could try replacing your first snippet
<txp:if_article_list>
<txp:article form="Single" status="sticky" />
<txp:else />
<txp:article form="Single" limit="1" />
</txp:if_article_list>
with this:
<txp:article form="default" status="sticky" />
<txp:article form="default" status="live" />
(take a look at this thread)
Saludos!
Offline
Re: "sticky" article kept in context of a "live" article list, how?
I saw that thread earlier today, Maniqui (very good thinking), but I didn’t think it would work because from the way it looks as written I will get the live articles too underneath the sticky article by default. However, I just tried it and Shazam! It works exactly as I want. Brilliant, Maniqui!
Offline