We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22829 ☆ A M B ☆
    • 80 Posts
    This is an auto-generated topic for getResourceField 1.0.0-beta1 by paulmerchant.

    Brief Description:

    This snippet will get a field or a TV value from the specified resource. TV values can be processed or unprocessed. For additional functionality, simply combine getResourceField with other snippets like UltimateParent.

    This is the first public version of this snippet. If you see any bugs or have feature request, please provide feedback in the forum’s getResourcesField support thread.

    Overview:

    OPTIONS
    id - The resource ID
    field - (Opt) The field or template variable name, defaults to pagetitle
    isTV - (Opt) Set as true to return a raw template variable
    processTV - (Opt) Set as true to return a rendered template variable
    default - (Opt) The value returned if no field is found

    Exmaple1: [[getResourceField? &id=`123`]]
    Example2: [[getResourceField? &id=`[[UltimateParent?]]` &field=`myTV` &isTV=`1`]]
    Example3: [[getResourceField? &id=`[[*parent]]` &field=`myTV` &processTV=`1`]]
      Time is what keeps everything from happening all at once.
      • 33337
      • 3,975 Posts
      If I am correct, this is like getField for Evo?
        Zaigham R - MODX Professional | Skype | Email | Twitter

        Digging the interwebs for #MODX gems and bringing it to you. modx.link
        • 22829 ☆ A M B ☆
        • 80 Posts
        Yes. This snippet can function like getField for Evo. I updated the first post in this thread with some information and will make sure the description comes through correctly in the Package Retriever when an RC1 or PL is released.

        [I might change it to RC1 very soon as I believe that there’s a version mismatch on the modx provider server. The package is saying that it needs to be updated with itself.]
          Time is what keeps everything from happening all at once.
          • 33337
          • 3,975 Posts
          Awesome. Thanks for sharing with us! smiley
            Zaigham R - MODX Professional | Skype | Email | Twitter

            Digging the interwebs for #MODX gems and bringing it to you. modx.link
            • 14353
            • 1 Posts
            Had a search around and couldn’t see this covered anywhere else (only obliquely in another topic). Let me know if this isn’t the right place to put this.

            On a recent project found it useful to be able to put the content from getResourceField into a placeholder variable so you can then apply filters (phpthumb, nl2br etc.) to the contents. Very quick modification to the snippet, replacing the final return with:

            $toPlaceholder = $modx->getOption('toPlaceholder',$scriptProperties,false);
            if (!empty($toPlaceholder)) {
              $modx->setPlaceholder($toPlaceholder, $output);
              return '';
            }
            return $output;​


            Will only work with a cached call to the snippet (e.g. [[getResourceField]] rather than [[!getResourceField]]).
              • 17422
              • 225 Posts
              Hi jnoel,

              i need use nl2br with getResourceField. but i don’t understand how use this.

              can you get me an example ?

              Laurent