Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-04-06 20:50:41

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,729
Website

Paging with article custom?

I have a section that uses txp:article_custom to list all the articles from several other sections except for 2-3 sections. It’s a multi-author site and each author has their own section. The articles from 2-3 sections that should be excluded are filtered out by using <txp:if_article_section name="section,to,exclude"><txp:else />... in the article form. The section does not have articles of its own.

There is no pageby attribute for article_custom, so what would be the best way of achieving some kind of pagination for this section? It will otherwise grow very large with time.

I tried the rsx_page_number but it seems its not working with txp 4.0.4 at all.

Also, related question 2: how could I generate an RSS-Feed for this page? The feed is currently blank (because no articles in that actual section?).

Last edited by jakob (2007-04-06 20:56:21)


TXP Builders – finely-crafted code, design and txp

Offline

#2 2007-04-06 21:40:09

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: Paging with article custom?

article_custom never paginates, what you see is what you get. I think you want a plugin like chh_article_custom (which can).

Offline

#3 2007-04-07 05:33:34

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,330
Website Mastodon

Re: Paging with article custom?

Out of curiosity: Why is article_custom built that way? Or, asking the other way round: Wouldn’t it be a reasonable feature to enable (optional) paging?

My problem with chh_article_custom is that it duplicates large parts of doArticles which is a very central part of Textpattern’s code.

Offline

#4 2007-04-07 06:27:34

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: Paging with article custom?

Why is article_custom built that way? Or, asking the other way round: Wouldn’t it be a reasonable feature to enable (optional) paging?

It was mainly intended for creating sidebars and similar features, where you’d have both a txp:article and txp:article_custom on the same page. Usually in those situations you’d want the main page content displayed by the txp:article tag to paginate, but not the article_custom tag in the sidebar.

Making article_custom paginate opens a can of worms, because in those situations you’d probably want the two tags to paginate independently.


Alex

Offline

#5 2007-04-07 13:42:58

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,729
Website

Re: Paging with article custom?

chh_article_custom also seems not paginate but chh_article will and sort of works in conjunction with the searchall attribute…

I see the searchall attribute is also in the txp core. Could a combination of txp:article and the searchall attribute be used to achieve pagination whilst searching multiple sections?

It’s not documented in the TextBook, so I’m not sure quite how searchall works.

2. It seems too that excluding entries using <txp:if_article_section><txp:else>... does stop those articles appearing but still counts as an article for pagination, with the result that older/newer thinks there are more articles than are shown. Am I right in thinking that the excluded sections have to be excluded from the mysql query?


TXP Builders – finely-crafted code, design and txp

Offline

#6 2007-04-07 18:48:06

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: Paging with article custom?

  1. searchall allows you to determine whether to search all articles for a given query string or to only search the current section. Its purpose is to allow you to have separated search for different sections. I suppose you might be able to twist this the way you want, but since that’s not what it was designed to do that could easily change at any time in the future.
  2. Your first sentence is accurate. I’m not sure what you are asking, though, in the second sentence.

Offline

#7 2007-04-07 21:58:03

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,729
Website

Re: Paging with article custom?

Thanks Mary. You’re right, the question is more indicative of my confused state of mind than anything else ;-)

What I meant was for the pagination to function correctly, I guess the exclusion of sections should happen as part of the MySQL query.

I couldn’t think of a way to achieve this using on-board functions so I slightly adapted one library function from chh_article to interpret a section="!section-to-exclude" in the comma-separated list as a AND ( Section != "section-to-exclude" ) MySQL filter and the pagination now works properly.


TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB