-
MODX Staff
- 10,725 Posts
You would have to process the TV value the same way the core parser does. This currently is not trivial, requiring you to reproduce code from the core, but will in the future be handled via the API’s.
Thanks for your reply. Is this something we can look forward to in .97 or further down the line? For now I’ll just forego using @INHEREIT for this if its not going to be too long.
-
☆ A M B ☆
- 24,524 Posts
Consider that the value of a TV with the default of @INHERIT is going to be just that, "@INHERIT", and only the parent (or perhaps grandparent or great-grandparent) document’s TV will have the actual output value. So your snippet would need to note that the value of the snippet for this document is literally "@INHERIT" and then traverse the document tree upwards until it finds a parent of this document that has a different value. That will be the output value you’re looking for.
-
☆ A M B ☆
- 24,524 Posts
Have you looked at the /manager/includes/tmplvars.commands.inc file?
snippet (parent_title)
<?php
// created by Badichan Dmitriy (c) badichan.com
$page = $modx->getObject('modResource', $input);
$id = $page->get('parent');
$parent_page = $modx->getObject('modResource', $id);
echo $parent_page->get('pagetitle');
?>
chunk
[[!parent_title? &input=`[[*parent]]`]]
[ed. note: badichan last edited this post 12 years, 8 months ago.]