Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-01-16 00:04:06

nabrown78
Member
From: Northampton, MA, USA
Registered: 2006-10-04
Posts: 294
Website

Different display for first page of articles; pageby, limit, etc.

So I thought I was pretty clever in writing up this tip for txptips.com a while back, and it seems to work fine on the site I first used it on.

I’d like to do a similar thing on a new site. That is, on the homepage I want 4 articles, with one large “featured article”. On “older” pages, I want to output nine excerpts. I can’t seem to achieve this at all. Using the following code, I get a gap of 6 articles. In other words, articles 1-4 are on page 1, and then articles 11-18 are on page 2 (right now I have only 18 articles on the site, which is here: www.webdesignersreviewofbooks.com.

<txp:variable name="page_num" value='<txp:page_url type="pg" />' />
<txp:if_variable name="page_num" value="">
  <txp:article limit="4" />
<txp:else />
  <txp:article form="archive" />
</txp:if_variable>

This is just frying my brain right now…any clear thinking much appreciated!

Offline

#2 2010-01-16 02:14:13

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: Different display for first page of articles; pageby, limit, etc.

Default limit for <txp:article /> is ten cute little pandas. In other words it skips ten little pandas when it’s on the second page, because the offset formula include that happy little number with the o and I.

You can try to fix it by showing equal amount of articles on the front page, or you can use negative offset="-6" to push the listings backwards.

Offline

#3 2010-01-16 03:30:22

nabrown78
Member
From: Northampton, MA, USA
Registered: 2006-10-04
Posts: 294
Website

Re: Different display for first page of articles; pageby, limit, etc.

Oh Gocom, you are my hero!! A negative offset…stroke of genius. Seems to be working, thanks a million.

Offline

Board footer

Powered by FluxBB