[pdoTools] 2.11.0 - disabling the total selection by default

Hello friends!

Let's start with some theory. All pdoTools snippets use the pdoFetch class to work with the database. During this, the total number of records will be calculated and set into the placeholder called [[+total]]. For maximum accuracy, this is done using the built-in MySQL functions:
SQL_CALC_FOUND_ROWS `id`,`pagetitle`
And MySQL will know the total amount of records.

After this query, a separate request is made for obtaining the result and setting the placeholder using:

This placeholder is needed exclusively for pagination and for outputting the quantity in showLog. Unfortunately, the query can take quite a long time. In the new version, the option setTotal is added directly to the pdoFetch class and is disabled by default.

Not all pdoTools calls necessarily need this, but since the placeholder [[+total]] is required for pagination, the snippet pdoPage enable the calculation query by default. When you call any snippet through pdoPage, this placeholder will be exposed.

I really hope that you will not notice any problems when updating your sites, but theoretically, it can pose problems if you need this placeholder for anything else than pagination.

If so, just turn it like this, with setTotal set to 1:

modx.pro already works on the new version and no issues were found.

I think speeding up pdoMenu, pdoCrumbs, pdoNeighbors and other snippets is worth the effort. Please stay updated, tested, and as usual, give feedback!
Gauke Pieter Sietzema
15 february 2018, 09:33

Comments: 0