We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26401
    • 247 Posts
    is it possible to get a resource field from a document without creating a snippet?

    for example I’d like to get the page name of the parent.
      • 22019
      • 390 Posts
      Simple, clunky way is to install use the getResourceField package:

      Something like:
      [[getResourceField? &id=`[[+parent]]` &field=`longtitle`]]
        Writer > E-consultant > MODx developer || Salesforce || modx 2.x || PHP 5.2.13 || MySQL client 5.0.86
        • 3749
        • 24,544 Posts
        Quote from: daspoda at Sep 25, 2010, 01:22 AM

        is it possible to get a resource field from a document without creating a snippet?

        for example I’d like to get the page name of the parent.

        I don’t know of one. You could use getResourceField or a simple snippet like this:

        <?php
        /* GetParentName snippet */
        $parent = $modx->resource-getOne('Parent');
        if ($parent) {
            return $parent->get('pagetitle');
        } else {
            return 'No Parent';
        }
          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting
          • 26401
          • 247 Posts
          great thanks guys!
          I saw getResourceField earlier and got it confused with getResources and then thought maybe it was in the core I saw it.