Textpattern CMS support forum

You are not logged in. Register | Login | Help

#201 2017-03-20 21:10:34

alicson
Member
Registered: 2004-05-26
Posts: 465
Website

Re: etc_pagination: paginate everything

And yes it seems to be frozen again.

I have

<txp:variable name="numPgs"><txp:etc_numpages section="journal,briefs,about,words" pageby="500" /></txp:variable>
<txp:variable name="nopage"><txp:etc_query name="nopage" data="{?numPgs|1|/500.intval.+2}" /></txp:variable>

and

<txp:etc_cache id='dense_archivebydate<txp:etc_query data=''<txp:page_url type="pg" />'' query="$min($|{?nopage}).max($|1)" />'>


textpattern.org :: find and share Textpattern resources
docs.textpattern.io :: Textpattern user documentation

Offline

#202 2017-03-20 21:24:05

etc
Developer
Registered: 2010-11-11
Posts: 2,200
Website

Re: etc_pagination: paginate everything

You divide by 500 twice. Try

<txp:variable name="numPgs" value='<txp:etc_numpages section="journal,briefs,about,words" pageby="500" />' />
<txp:etc_query name="nopage" data="{?numPgs|1|.+1}" />

etc_[ query | search | pagination | date | tree | cache ]

Offline

#203 2017-03-20 21:39:23

etc
Developer
Registered: 2010-11-11
Posts: 2,200
Website

Re: etc_pagination: paginate everything

alicson wrote #304948:

For my own sense, is there a reason why an enduser (spam) can make up page numbers and slam the site that way? Or does it generally just not matter, except when one happens to have combinations of pagination and caching set up without having further accounted for queries of miscellaneous imaginary page numbers?

I’m not a behavioral specialist, sorry. :-) In general it does not matter, but in your case etc_cache will create a record for every encountered (even invalid) pg value and try to update it later. This will take unnecessary time and space.

And what do the .max($|0) vs. the .max($|1) mean?

Zero was a mistype, sorry. .max($|1) means for etc_query the maximum between 1 and the initial data passed by the chain:

<txp:etc_query data="2" query="$*2.+1.max($|3)" />

reads as 2 -> 2*2=4 -> 4+1=5 -> max(5, 3)=5.


etc_[ query | search | pagination | date | tree | cache ]

Offline

#204 2017-03-20 21:49:53

alicson
Member
Registered: 2004-05-26
Posts: 465
Website

Re: etc_pagination: paginate everything

I didn’t mean human-behavior-wise, I meant the structure of the site allowing for calls to imaginary pages that can cause a problem. ;) Sounds like the answer is the “create a record for every encountered (even invalid) pg value”.

Ahh txp:etc_query can assign like txp:variable; no wonder.
I think it’s good to go now, again with much thanks :)


textpattern.org :: find and share Textpattern resources
docs.textpattern.io :: Textpattern user documentation

Offline

#205 2017-03-20 22:29:42

etc
Developer
Registered: 2010-11-11
Posts: 2,200
Website

Re: etc_pagination: paginate everything

Yep, your site seems to work faster now. Have you cached “Category slates” and “Months menu” too? Good luck, and glad to help! :-)


etc_[ query | search | pagination | date | tree | cache ]

Offline

Board footer

Powered by FluxBB