Skip to content
  1. Extras
  2. pdoTools

pdoTools

pdoTools is a set of handy snippets for everyday use plus a small library that makes them very fast.

MODX 3 line

pdoTools 3.x (current: 3.1.0-pl) needs MODX Revolution 3 and PHP 8.1+. Source: modx-pro/pdoTools3. For MODX 2 use pdoTools 2.x.

Thanks to the shared library, all pdoTools snippets share the same minimal feature set:

  • All database queries use PDO. xPDO objects are not created unless they are actually needed.
  • Simple placeholders are preprocessed in chunks. The MODX parser only handles complex calls.
  • Proper sorting, preparation, processing and output of TV parameters.
  • Chunk code can be specified right in the snippet call, or loaded as usual or from static files.
  • "Fast placeholders" in chunks that replace filters like "isempty" and wrap values in tags only when non-empty.
  • Timestamped snippet log for debugging (&showLog). In 3.x the log is a placeholder: general parameters.

All queries are built on xPDO; data is fetched via PDO for resource and speed efficiency.

The package includes:

  • pdoResources — Much faster replacement for getResources, parameter-compatible.
  • pdoMenu — Replacement for Wayfinder, builds menus.
  • pdoUsers — Select and output site users, with filtering by roles and groups.
  • pdoCrumbs — Breadcrumbs, replacement for BreadCrumb.
  • pdoSitemap — Fast sitemap generation, replacement for GoogleSiteMap.
  • pdoNeighbors — Output links to neighboring documents.
  • pdoField — Output any document field, replacement for getResourceField and UltimateParent.
  • pdoPage — Paginated output, replacement for getPage.

Main features

  • Arbitrary queries from any tables with any conditions and joins.
  • Time tracking per operation, detailed log to find bottlenecks.
  • Full compatibility with getPage for paginated output.
  • Fastest chunk processing — only going without chunks is faster.
  • Built-in Fenom template engine.

What is new in 3.1.0 (MODX 3)

Available in pdoTools 3.1.0+ (MODX 3)

These items need the 3.1.0-pl package (or newer) on MODX 3.

  • Row flags in chunks: isFirst, isLast, isActive (pdoMenu, pdoPage, pdoCrumbs); menu also hasChildren / hasChilds, isHere, isStart, isCategory, isInner; page isSkip; crumbs isHome. Existing tpl* chunks still work when set.
  • pdoMenu: [[+children]] in &tplInner.
  • Fenom type casts: boolval, doubleval, floatval, intval, strval. array_merge is allowed by default.
  • Option key pdotools_cache_path for Fenom/pdoTools cache directory (default {core_path}cache/pdotools).
  • pdoPage: snippet call properties are available as placeholders inside pagination templates.
  • pdoFetch: extra categories use MiniShop3 (msCategoryMember). Pass &disableMS3=1 to skip. miniShop2 / &disableMS2 are removed.
  • Fenom compile/runtime errors name the chunk or resource and include a source excerpt (cache key stays a content hash).
  • Snippet result cache keys include the current context.