Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Not show first article while using etc_pagination plugin
Hey guys, I am trying to set up my front page to not show the first article while using the etc_pagination plugin. The code I am using at the moment is:
<!-- display first article with differnt layout -->
<txp:article_custom section="articles,articles-taid" limit="1" form="first_article" />
<!-- articles display -->
<txp:article_custom limit="30" section="articles,articles-taid"
offset='<txp:etc_offset offset="1" pgcounter="page" pageby="20" />'
/></p>
<!-- pagination bar -->
<div align="center"><txp:etc_pagination
pages='<txp:etc_numpages section="articles,articles-taid" pageby="30" />'
range="15"
pgcounter="page"
next="Older" prev="Newer"
/></div>
Now, it works perfectly fine, except, I don’t want to show the first article under the larger view, I understand I need to use the “offset=1” tage, but I am unsure where I need to place it.
Any ideas would be great! Thanks in advance!
Offline
Re: Not show first article while using etc_pagination plugin
Hi Sam,
I think the simplest option is <txp:if_first_article />
tag:
<!-- articles display -->
<txp:article_custom limit="30" section="articles,articles-taid"
offset='<txp:etc_offset pgcounter="page" pageby="30" />'
>
<!-- display first article with differnt layout -->
<txp:if_first_article>
<!-- specific layout -->
<txp:else />
<!-- general layout -->
</txp:if_first_article>
</txp:article_custom>
Now, if you need a specific layout only for the very first article (of the first page), you will need to check the value of page
URL parameter (with adi_gps
or etc_query
). I could also add some <txp:etc_page_number />
tag in the next version of etc_pagination
if it’s useful.
Offline
Re: Not show first article while using etc_pagination plugin
That works great, thank you. (I had tried it before but I had the code all the wrong way so nothing loaded!) How would I make it so it was just the first article on the first page that shows differently? Would I need to install etc_query as a plugin or is it a feature within etc_pagination?
Offline
Re: Not show first article while using etc_pagination plugin
SPKuja wrote:
Would I need to install etc_query as a plugin or is it a feature within etc_pagination?
Just for this, etc_query
would be an overkill (adi_gps
is more appropriate), but here we go:
<!-- import the current page number into page_number variable, can be done also with adi_gps, see its thread -->
<txp:etc_query name="page_number" data="{?page|1|intval}" globals="_GET" />
<!-- articles display -->
<txp:article_custom limit="30" section="articles,articles-taid"
offset='<txp:etc_offset pgcounter="page" pageby="30" />'
>
<!-- display first article with differnt layout -->
<txp:if_variable name="page_number" value="1">
<txp:if_first_article>
<!-- specific layout -->
<txp:else />
<!-- general layout -->
</txp:if_first_article>
<txp:else />
<!-- general layout -->
</txp:if_variable>
</txp:article_custom>
There must be a better way, but I can’t see it right now.
Offline
Re: Not show first article while using etc_pagination plugin
That works perfectly, thank you so much for your help :)
Offline
Re: Not show first article while using etc_pagination plugin
I’m dumb, <txp:variable name="page_number" value='<txp:etc_offset pgcounter="page" />' />
and <txp:if_variable name="page_number" value="0">
should suffice, so there is no need for another plugin.
Offline
Re: Not show first article while using etc_pagination plugin
Fair enough! I’ll give it ago, thanks :)
Offline