Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
First Article Help
Hi this is a form I use for outputting a list of articles on my blog page. the idea is that the first article will have full body text and then the rest just the intros. BUT the posts are limited to 5 and then span over numerous pages. The problem is that on page two the first article will also spit out full body text, so what im wanting to do is as well as check for if_first_article, also check that its the first page.
<div class="post">
<div class="post-date">
<span><txp:posted format="%d/%m/%Y" /></span>
</div>
<div class="post-comments">
<span><a href="<txp:permlink />#comments" title="Add a Comment"><txp:comments_count /></a></span>
</div>
<h2><a href="<txp:permlink />" title="<txp:title />"><txp:title /></a></h2>
<txp:if_first_article><txp:body /><txp:else /><txp:excerpt /></txp:if_first_article>
<txp:if_first_article><txp:else /><p><a href="<txp:permlink />" title="<txp:title />">continue reading...</a></p></txp:if_first_article>
</div>
<txp:if_last_article><txp:else /><hr /></txp:if_last_article>
~ Cameron
Offline
Offline
Re: First Article Help
Will this detect the first page or the front page?
~ Cameron
Offline
Re: First Article Help
driz wrote:
Will this detect the first page or the front page?
Sounds like it to me.
soo_if_frontpage
evaluates totrue
if the current page context is:
- an article list, and;
- not search results, and;
- not a listing of articles by category, and;
- not a listing of articles by author, and;
- not a listing of articles by month, and;
- (optionally) in one of the sections listed in the
section
attribute, and;- (optionally) a single-page list or the first page of a multi-page list, if the
pg
attribute is set.
Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker
Offline
Re: First Article Help
Is the correct way of using it?
<txp:soo_if_frontpage>
<txp:if_first_article>
<txp:body />
<txp:else />
<txp:excerpt />
</txp:if_first_article>
<txp:else />
<txp:excerpt />
</txp:soo_if_frontpage>
Last edited by driz (2009-08-02 11:35:23)
~ Cameron
Offline
Re: First Article Help
driz wrote:
Is the correct way of using it?
<txp:if_soo_page><txp:if_first_article><txp:body /></txp:if_first_article><txp:else /><txp:excerpt /></txp:if_soo_page>
No:) Try
<txp:soo_if_frontpage><txp:if_first_article><txp:body /><txp:else /><txp:excerpt /></txp:if_first_article><txp:else /><txp:excerpt /></txp:soo_if_frontpage>
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: First Article Help
Yeh tried that, but it only works on front page, when i go to page 2 they are all spitting out the body instead of ONLY the excerpts!
EDIT: adding pg="1"
to the <txp:soo_if_frontpage> fixes the problem. Thanks.
So for anyone who also wants to do this, here is the full code you need to put in your article form:
<txp:soo_if_frontpage pg="1">
<txp:if_first_article>
<txp:body />
<txp:else />
<txp:excerpt />
<p><a href="<txp:permlink />" title="<txp:title />">continue reading...</a></p>
</txp:if_first_article>
<txp:else />
<txp:excerpt />
<p><a href="<txp:permlink />" title="<txp:title />">continue reading...</a></p>
</txp:soo_if_frontpage>
Last edited by driz (2009-08-02 11:42:25)
~ Cameron
Offline
Re: First Article Help
Try this:
<txp:soo_if_frontpage pg="1">
<txp:if_first_article>
<txp:body />
<txp:else />
<txp:excerpt />
<p><a href="<txp:permlink />" title="<txp:title />">continue reading...</a></p>
</txp:if_first_article>
<txp:else />
<txp:excerpt />
<p><a href="<txp:permlink />" title="<txp:title />">continue reading...</a></p>
</txp:soo_if_frontpage >
Whitespace added to make the logic a little clearer.
Kind of a pain that you have to repeat the excerpt/permlink block, but that’s the way it is with stacked conditionals when you want to cover every case. Note that the pg
attribute is a boolean — it does not refer to a particular page number.
Edit: too slow!
Last edited by jsoo (2009-08-02 11:44:24)
Code is topiary
Offline
Pages: 1