modx-revolutionmodx-getresources

MODX getResources filter


I need to filter my getResources so that the [[*longtitle]]s of filtered resources match [[*pagetitle]] of the resource where getResources snippet is used.

Can this be done?

Thanks


Solution

  • The docs seem to indicate that you can:

    WHERE : A JSON-style expression of criteria to build any additional where clauses from. See below for an example. See display/xPDO20/xPDOQuery.where

    So try something like:

    [[!getResources?  &where=`{"longtitle":[[*pagetitle]]}`]]
    

    you might need quotes around the pagetitle.