getTemplateVar Replacement in MODx Revolution

getTemplateVar has now been removed from the MODx framework so the method of getting the value has (obviously) changed.

You now need to do this for the current document:

$val = $modx->resource->getTVValue('name_of_tv');
$val = $modx->resource->getTVValue($id); // Id of the tv (not the document)

or

$resource = $modx->getObject('modResource',array('pagetitle'=>'SomePage'));
$val = $resource->getTVValue('name_of_tv');
$val = $resource->getTVValue($id); // Id of the tv (not the document)

Of this if you need the value from another document:

$thumbtv = $modx->getObject('modTemplateVar',array('name'=>'Thumbnail')); // Get the Template Variable 'Thumbnail'
$thumbraw = $thumbtv->getValue($row['id']); // Get the value for a particular id
$thumb = $thumbtv->renderOutput($row['id']); // Or get the output for a particular id

About Keiron

Web Developer based in the UK. Click here if you want to work with me