Quote from: BobRay at Jun 19, 2011, 07:49 PM
You’re missing an argument. It should be:
$field = $modx->getParent($id, 1, 'pagetitle');
Hey thanks for the tip, it still doesn’t work though, I get nothing replied. Don’t know what I’m overlooking so I will check out getResourceField too
Update:
Using resourcefield I got this:
[[+getResourceField? &id='5']]
Which returns: Personal
Which is OK.
But when I put it like this, since the category is dynamic:
[[+getResourceField? &id='[[*parent]]']]
I get nothing returned.
Anyone?
My guess is that I am trying to get the parent of the ’Home’ page. Since I’m including the script on the Home page?
When I print parent I get a ’0’ (zero). But when I echo the pagetitle, it does give me the correct title for the child...
Update2:
Ok one step further now:
[[getResourceField? &id=`[[+id]]` &field=`parent`]]
This now returns me the correct parent number. How, how do I get the title?
Because this:
[[getResourceField? &id='[[getResourceField? &id=`[[+id]]` &field=`parent`]]']]
..doesn’t seem to work...
Last update:
Solved! YEASHHHHHHHHHHHHHHHHHHH!
[[!getResourceField? &id=`[[getResourceField? &id=`[[+id]]` &field=`parent`]]`]]
Explanation:
In the Snippet guidelines it says to alternate cached and uncached snippets when placing them inside of eachother.
It’s explained to do so like this:
[!snippet? &snippet2='[[snippet2]]'!]
But actually putting it like that doesn’t work.
But like this it works:
[[!snippet? &snippet2='[[snippet2]]']]