Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 Yesterday 11:29:48

abu
Plugin Author
From: Switzerland
Registered: 2025-04-03
Posts: 14
GitHub GitLab Mastodon

No pagination with article_custom

I create an article list for a particular year.

<txp:article_custom section="articles" month='2025'
    class="article-list"
    form="article_listing"
    limit="10"
    wraptag='ul' />

The first 10 matching articles are rendered, but not the older/newer links created by the following code.

<txp:evaluate test="older,newer">
	<nav class="page-item paginator" aria-label="<txp:text item="page_nav" />">
		<txp:older rel="next">
			&laquo;&nbsp;<txp:text item="older" />
		</txp:older>
		&nbsp;<txp:output_form form="home_button" /> &nbsp;
		<txp:newer rel="prev">
			<txp:text item="newer" />&nbsp;&raquo;
		</txp:newer>
	</nav>
</txp:evaluate>

Further on, two errors are thrown.

Tag error: **<txp:older rel="next">
				&laquo;&nbsp;<txp:text item="older" />
			</txp:older>** -> ** Textpattern Warning: secondpass < 2 while parsing form **None** on page **archive****
Tag error: **<txp:newer rel="prev">
				<txp:text item="newer" />&nbsp;&raquo;
			</txp:newer>** -> ** Textpattern Warning: secondpass < 2 while parsing form **None** on page **archive****

What’s wrong here? What did I miss?

Offline

#2 Yesterday 12:04:06

etc
Developer
Registered: 2010-11-11
Posts: 5,539
Website GitHub

Re: No pagination with article_custom

By default, <txp:article_custom /> does not get/set pagination data. There are two options:

  • either use <txp:article ... /> instead (preferred, but limited in txp 4.8)
  • or add pageby and offset attributes:
<txp:article_custom pageby offset ... />

Hope that helps.

Offline

#3 Yesterday 12:49:45

abu
Plugin Author
From: Switzerland
Registered: 2025-04-03
Posts: 14
GitHub GitLab Mastodon

Re: No pagination with article_custom

etc wrote #341105:

By default, <txp:article_custom /> does not get/set pagination data. There are two options:

  • either use <txp:article ... /> instead (preferred, but limited in txp 4.8)
  • or add pageby and offset attributes:

<txp:article_custom pageby offset ... />...

Hope that helps.

p.

Yes, it does, at least partially. The errors are gone now. Thanks so far.

Offline

#4 Yesterday 20:02:35

abu
Plugin Author
From: Switzerland
Registered: 2025-04-03
Posts: 14
GitHub GitLab Mastodon

Re: No pagination with article_custom

The remaining problem is that, the search term in the URL is missing in all suceeding pages.

Initial:
http://txp.local/index.php?s=articles&d=2022

Succeeding: (after clicking on “older”)
http://txp.local/index.php?s=articles&pg=2

By the missing &d=2022 the default txp:article will be called instead of txp:article_custom, leading to an unwanted result.

I have currently no idea how to solve this. What is the Textpattern way for such problems?

Offline

#5 Yesterday 22:18:13

etc
Developer
Registered: 2010-11-11
Posts: 5,539
Website GitHub

Re: No pagination with article_custom

You an try to wrap the older/newer block in

<txp:page_url context="s,d">
...
</txp:page_url>

Add to context other pertinent URL parameters if needed.

Offline

#6 Today 08:30:43

abu
Plugin Author
From: Switzerland
Registered: 2025-04-03
Posts: 14
GitHub GitLab Mastodon

Re: No pagination with article_custom

Perfect! It works like a charm. Huge Thanks!

Offline

Board footer

Powered by FluxBB