Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-11-17 19:45:08

richtestani
Plugin Author
Registered: 2009-11-08
Posts: 128

Get a sticky displaying on other pages beside a listing?

Code:

<div class="section blog full">
<txp:article_image class="blog_image" />
<div class="blog_top">
	<div class="blog_date"><txp:posted format="<span class='blog_posted_month'>%b</span><span class='blog_posted_day'>%d</span>" /></div>
	<h1 class="blog_title"><txp:title /></h1>
</div>
<div class="full">
<txp:body />
</div>
<txp:if_individual_article>
<div id="sidebar">
<txp:article status="sticky" />
</div>
</txp:if_individual_article>
<div class="clear"></div>
</div>

The sticky doesn’t load with this code, nor does it load if I place anywhere.
It loads on the initial listing page.

Any ideas why this is?
Thanks
Rich

Last edited by richtestani (2009-11-17 19:59:07)

Offline

#2 2009-11-17 20:35:31

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Get a sticky displaying on other pages beside a listing?

I assume you expected <txp:article status="sticky" /> to display a different article, not the current individual one? <txp:article /> is context sensitive, so on an individual article page, it will only display the current individual article (the one that is in the URL). Use <txp:article_custom /> instead.

Offline

#3 2009-11-17 21:16:51

richtestani
Plugin Author
Registered: 2009-11-08
Posts: 128

Re: Get a sticky displaying on other pages beside a listing?

I expected it to load the articled with a status of sticky.

The way I thought it worked, was:

the <txp:article /> tag would control both listing and individual articles specified with listform and form attributes. So I have 2 forms, one for each situation.
In each form, I load articles that use the sticky status. <txp:article status=“sticky” /> which loads on the listing, but not on a category list or individual article.

So clicking a permlink would load an individual article.
Should I use the article_custom in this scenario?
thanks
rich

Offline

#4 2009-11-17 21:53:17

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Get a sticky displaying on other pages beside a listing?

This is what <txp:article limit="10" form="singleform" listform="listform" /> displays:

  • on an individual article page: the requested individual article, using form ‘singleform’
  • on a section (list) page: 10 articles in that section, using form ‘listform’
  • on a category (list) page: 10 articles in that category, using form ‘listform’
  • on a search results page: 10 search results, using form ‘search_results’
  • on the front page: 10 articles in the sections that are set to be displayed on the front page, using form ‘listform’

If you add status="sticky" it will display only sticky articles, and if you leave it out it will display only live articles, but either way it won’t display anything else than requested in its context.

If the code you posted is inside an article form (and it looks to me like it is), I assume it’s displaying article_image, title and body of an individual article, and it is meant to display another (sticky) article in the sidebar. Am I right? Apart from the fact that you just can’t have a <txp:article /> tag inside an article form, even if you could it would only display the same individual article. So my guess is that you really need <txp:article_custom />.

Offline

#5 2014-03-24 03:44:04

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: Get a sticky displaying on other pages beside a listing?

Sometimes I need a section’s sticky article to appear on an individual article page. This works for me:

<txp:article_custom section='<txp:section />' status="sticky" />

<txp:article />

It works for both article listing page and individual article page – it’s the section='<txp:section />' bit that forces the fix.

Offline

Board footer

Powered by FluxBB