We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 349
    • 76 Posts
    I want to display a listing of documents via the getResources snippet, then link to the detail page of the document and display the template chunk again.
    But for getResources you have to write a different syntax for the template variables (you have to use them as placeholders).

    This is my snippet call:
    [[!getResources? &parents=`33` &tpl=`adresse` &processTVs=`1` &includeTVs=`1` &tvPrefix=``]]

    Here is my chunk "adresse":
    [[If? &subject=`[[+Ort]]` &operator=`notempty` &then=`[[+Ort]]`]]

    This functions correctly on the overview page, but when i am on the detail page i have to use
    [[If? &subject=`[[*Ort]]` &operator=`notempty` &then=`[[*Ort]]`]]

    So how can i use my chunk for the overview page and detail page without duplicating code?

    Also there is a problem with rendering my [[+URL]] placeholder as a Link (as defined in the output type for this TV). It displays as a normal text. This doesn´t happen, when i use [[*URL]]
      • 22303 MODX Staff
      • 10,725 Posts
      Correct, [[*ContentField]] tags apply to the current Resource being executed. Using getResources means you are on a different Resource than the one being processed, so you cannot use those tags (otherwise it will pull in the data from the current Resource if it exists). You’ll need to render content from the external Resource that does not contain those tags.

      Regarding TV’s being rendered raw vs. processed, this is a result of the getResources property &processTVs being set to `0` (false) by default.