Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2021-12-12 06:38:39

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,599
GitHub Twitter

"Second pass < 1" mystery

I noticed when setting “Number of extra parser sweeps” to 0 within the default theme, we’ve got a warning message on search results:

Try here: https://dev-demo.textpattern.co/4.8.8/?q=a

Devs, could you explain why and how to deal with no extra parser?


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#2 2021-12-12 10:12:56

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

Re: "Second pass < 1" mystery

Pat64 wrote #332171:

Devs, could you explain why

The reason is, say, <txp:search_result_count /> needs <txp:article /> to be parsed before, to populate some pagination data. Now, what if <txp:search_result_count /> must be output before <txp:article />, as in the default theme:

<txp:search_result_count /><!-- pb: pagination data is missing -->
<txp:article />

Before 4.7 one needed pgonly:

<txp:article pgonly="1" /><!-- pagination data is populated here -->
<txp:search_result_count />
<txp:article />

Since 4.7, if the pagination data is not available (yet), <txp:search_result_count /> (and the likes) postpones itself to the second parser pass, enabled by default since ages:

<txp:search_result_count /><!-- pagination data is missing, the tag is left untouched -->
<txp:article /><!-- pagination data is populated here -->
<-- second pass -->
<txp:search_result_count /><!-- the tag is parsed now -->
...

But if you disable the second pass, this will not work and txp will warn you.

and how to deal with no extra parser?

Either use pgonly, as before, or manage to put <txp:search_result_count /> and <txp:article /> on the same level in the page tree and make txp parse <txp:article /> first:

<txp:search_result_count />
<txp:article[1] /><!-- will be parsed first among its siblings -->

Offline

#3 2021-12-12 10:28:30

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,599
GitHub Twitter

Re: "Second pass < 1" mystery

Thank you, Oleg.
Perfect (and well explained)!


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

Board footer

Powered by FluxBB