<?php $tvId = 104; $tv1 = $modx->getObject('modTemplateVarResource',array ('tmplvarid'=>$tvId,'contentid' => $id)); $val = $tv1->getValue(); $modx->log(modX::LOG_LEVEL_ERROR,'Testing Output: ' . $val);
<?php $modx->log(modX::LOG_LEVEL_ERROR,'Testing Output: ');
<?php $modx->log(modX::LOG_LEVEL_ERROR,'Testing Output: ' . $modx->resource->getTVValue('guideParentID'));
This question has been answered by BobRay. See the first response.
Failed to load resource: the server responded with a status of 500 () (index.php) Uncaught Object message: "JsonReader.read: Json object not found" (ext-all.js:21)
$contentId = $modx->resource->get('id'); $tvr = $modx->getObject('modTemplateVarResource',array ('tmplvarid'=>$tvId,'contentid' => $contentId)); if ($tvr) { $val = $tv1->get('value'); }
$tvId = 104; $contentId = $modx->resource->get('id'); $tv = $modx->getObject('modTemplateVar', $tvId); if ($tv) { $val = $tv->getValue($contentId); // gets the raw value of the TV // or // $val = $tv->renderOutput($contentId); // gets the processed value of the TV (e.g., for image TVs, dates, and maybe MIGX TVs) }
<?php $contentId = $modx->resource->get('id'); $tv_guideParentID_ID = 48; $tv_guideParentID = $modx->getObject('modTemplateVar', $tv_guideParentID_ID); if ($tv_guideParentID) { $tv_guideParentID_val = $tv_guideParentID->getValue($contentId); $modx->log(modX::LOG_LEVEL_ERROR,'tv_guideParentID: ' . $tv_guideParentID_val); $tv_guideChangeLog_ID = 37; $tv_guideChangeLog = $modx->getObject('modTemplateVar', $tv_guideChangeLog_ID); if ($tv_guideChangeLog) { $changeDate = $modx->runSnippet('getImageList',array( 'docid' => $contentId, 'tvname' => 'guideChangeLog', 'tpl' => 'guideChangeLogDateNoFormatTpl', 'reverse' => '1', 'limit' => '1' )); $modx->log(modX::LOG_LEVEL_ERROR,'changeDate: ' . $changeDate); } }