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.
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
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';
}
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.