<body class="[[*bodyclass]]">
<?php
if ($modx->resource->get('parent')) {
$tv = $modx->getObject('modTemplateVar', array('name' =>'setChildbodyclass'));
$setTV = $tv->getValue($modx->resource->get('parent'));
$modx->resource->setTVValue('bodyclass', $setTV);
}[2011-11-08 12:25:03] (ERROR @ /connectors/resource/index.php) Error caching lexicon topic lexicon/en/core/resource [2011-11-08 12:41:41] (ERROR @ /connectors/element/index.php) Error caching lexicon topic lexicon/en/core/default [2011-11-08 13:06:21] (ERROR @ /connectors/element/propertyset.php) Error caching action map mgr/actions [2011-11-08 13:08:48] (ERROR @ /connectors/element/propertyset.php) Error caching lexicon topic lexicon/en/core/default [2011-11-08 13:08:48] (ERROR @ /connectors/element/propertyset.php) Error caching action map mgr/actions [2011-11-08 13:13:55] (ERROR @ /connectors/element/propertyset.php) Error caching lexicon topic lexicon/en/core/default [2011-11-08 13:23:04] (ERROR @ /connectors/element/propertyset.php) Error caching lexicon topic lexicon/en/core/default [2011-11-08 13:42:16] (ERROR @ /connectors/element/index.php) Error caching lexicon topic lexicon/en/core/element
This question has been answered by [email protected]. See the first response.
//test if this is a child of a container
if ($resource->getOne('Parent')) {
//create a parent object to retrieve the value of the TV we want (setChildbodyclass)
$parentObj= $resource->getOne('Parent');
//retrieve the value
$parentSetChildVal= $parentObj->getTVValue('setChildbodyclass');
//set the value of bodyclass in the current resource to the value of setChildbodyclass in parent
$resource->setTVValue('bodyclass', $parentSetChildVal);
}