Skip to content
  1. Extras
  2. pdoTools
  3. General properties

General parameters

Common parameters for snippets based on pdoTools/pdoFetch. They are shared by pdoResources, pdoPage, pdoMenu, pdoCrumbs and other pdoTools snippets. The tables below group parameters by purpose: resource selection, template (chunk) choice, and output format.

Resource selection parameters

These parameters define which objects are selected.

NameDefaultDescription
&classmodResourceClass of the objects to fetch
&parentsCurrent resourceComma-separated parent IDs for the query. Use 0 for no limit. Prefix with minus to exclude that parent and its children
&depth10Depth of child resources from parent
&resourcesComma-separated resource IDs to output. Prefix with minus to exclude a resource
&templatesComma-separated template IDs to filter by. Prefix with minus to exclude resources with that template
&contextLimit selection by resource context
&whereJSON-encoded array of extra query conditions
&showHidden0Include resources hidden from menu
&showUnpublished0Include unpublished resources
&showDeleted0Include deleted resources
&hideContainers0Do not output containers (resources with isfolder = 1)
&hideUnsearchableExclude resources hidden from search
&selectComma-separated list of fields to select, or JSON e.g. {"modResource":"id,pagetitle,content"}
&leftJoin, &rightJoin, &innerJoinAnalog of SQL left/right/inner join
&joinSequenceinnerJoin,leftJoin,rightJoinOrder of joining tables, comma-separated
&sortbypagetitleAny resource field to sort by, including TV if in &includeTVs. JSON for multiple fields. Use RAND() for random order
&sortdirASCSort direction: ascending or descending
&groupbyField to group results by
&havingCondition to filter grouped rows (used with &groupby)
&limit0Maximum number of results. Can be 0
&offset0Number of results to skip from the start
&first1Index of first output iteration
&lastAuto: total + first - 1Index of last output iteration
&loadModelsComma-separated list of components whose models to load for the query, e.g. ms2gallery,msearch2
&tvFiltersTV filters with AND and OR. OR delimiter is in &tvFiltersOrDelimiter; conditions are grouped by OR first. Use &tvFiltersAndDelimiter within a group. Example: `filter2==one,filter1==bar%
&tvFiltersAndDelimiter,Delimiter for AND conditions in &tvFilters
&tvFiltersOrDelimiter`
&sortbyTVExtra field to sort by; can also be set in &sortby
&sortdirTVSort direction for the field in &sortbyTV; can be in &sortby
&sortbyTVTypeType for TV sort: string, integer, decimal, datetime. If empty, TV is sorted by its type
&checkPermissionsWhich permissions to check for the user when outputting objects
&disableConditionsDisable conditions specific to modResource
&fenomModifiersComma-separated list of modifier snippets to register in Fenom. See section

Template parameters

These set the chunks (templates) used to generate output.

NameDescription
&tplChunk name for a resource row. If not set, resource fields are printed as-is
&tplFirstChunk for the first resource in the result
&tplLastChunk for the last resource
&tplOddChunk for every even-position resource (name "odd" but applies to even)
&tpl_NChunk for the N-th resource, e.g. &tpl_4=tpl4th` for the 4th
&tpl_nNChunk for every N-th resource, e.g. &tpl_n4=tplEvery4th` for every 4th
&tplConditionResource field whose value is used to choose chunk via &conditionalTpls
&tplOperatorOptional operator for comparing &tplCondition with values in &conditionalTpls
&conditionalTplsJSON object: keys = values to compare with &tplCondition, values = chunk names. For operators like isempty use an array without keys
&outputSeparatorOptional string to separate results

Output parameters

These control what data is output and how.

NameDefaultDescription
&returnchunksOutput mode. See below
&fastMode0Fast chunk processing: all unprocessed tags (conditions, snippets, etc.) are stripped
&nestedChunkPrefixpdotools_Prefix for "fast placeholders" when using &fastMode
&idxStarting index for output iteration
&totalVartotalPlaceholder name for total result count
&includeContent0Include content field in selection
&includeTVsComma-separated list of TV names to select, e.g. action,time gives placeholders [[+action]], [[+time]]
&includeTVListAlias of &includeTVs
&prepareTVs1TVs (with media sources) to prepare with full paths. 1 = all from &includeTVs
&processTVsTVs to process and output per manager settings. 1 = all from &includeTVs. Slows output
&tvPrefixtv. in pdoResources, empty in othersPrefix for TV placeholders
&prepareSnippet1Snippet that receives data before output to chunk and can change or add to it
&decodeJSONParse JSON fields instead of outputting as string
&scheme-1URL scheme for modX::makeUrl(); see docs. Special value uri uses resource uri without calling the function
&useWeblinkUrlGenerate URL according to resource class
&toSeparatePlaceholdersIf set, all results are put in separate placeholders named by this value + row index from 0, e.g. myPl[[+myPl0]], [[+myPl1]]
&additionalPlaceholdersSet extra placeholders
&cache_keyresource or defaultCache key
&cache_handlerxPDOFileCache or settingCache handler
&cacheTime0 or settingCache TTL in seconds

Chunk call types

Chunks can use one of these prefixes:

@INLINE or @CODE. The template is the code after this prefix.

modx
[[!pdoResources?
  &parents=`0`
  &tpl=`@INLINE <li>[[+pagetitle]]</li>`
]]

In INLINE chunks you must not use snippets, other chunks or output filters in the usual MODX tags, because the parser processes them first and the snippet would get the wrong content.

So for INLINE chunks use {{+}} instead of [[+]] — MODX leaves these as-is and pdoTools converts them. You can still use MODX tags when you need already-processed content in the chunk, for example:

modx
[[!pdoResources?
  &parents=`0`
  &tplFirst=`@INLINE Current page: [[*pagetitle]]`
  &tpl=`@INLINE <p>[[+id]] - [[+pagetitle]]<p>`
]]

@FILE. Use file contents instead of a chunk from the database. Path is from system setting pdotools_elements_path. File extension must be .tpl or .html.

modx
[[!pdoResources?
  &tpl=`@FILE fileBasedRow.tpl`
]]

@TEMPLATE. Template id or name. If empty, each resource uses its own template.

modx
[[!pdoResources?
  &tpl=`@TEMPLATE 10`
]]

@CHUNK. Same as specifying a chunk name; kept for compatibility with third-party snippets.

modx
[[!pdoResources?
  &tpl=`@CHUNK tpl.Resource.row`
]]

[[!pdoResources?
  &tpl=`tpl.Resource.row`
]]

More in the pdoParser section.

Return values

pdoTools can return data in different forms via &return. Mainly used by snippets internally, but you can set &return in pdoResources:

modx
[[!pdoResources?
  &parents=`0`
  &return=`json`
]]
  • chunks — formatted chunks (default).
  • sql — prepared raw SQL, useful for debugging. Query is not executed, only printed.
  • data — array of data. Due to MODX snippet behavior, use only when calling pdoFetch::run() from your own snippet; otherwise you get the string "Array".
  • ids — comma-separated document ids. Useful as input for other snippets. &returnIds uses this.
  • json — JSON string of the data array.
  • serialize — serialized string. Can sometimes cause memory issues; prefer json.

Внимание

All &return values are supported only by pdoResources (pdoPage with pdoResources) and pdoUsers.

pdoMenu and pdoCrumbs support chunks and data.

Other snippets mostly support only chunks.