...displays an image if there’s a url spec’d in the TV, however, when there’s no TV value the code’s still displaying (missing image icon) on the page. For Evo.
<?php
// Checks for image url in TV and displays if present
$document_tvs = $modx->getTemplateVarOutput(true, $id);
$image = $document_tvs['titleImage'];
$output='';
if (isset($image)) {
$output = '<div class="title-img" ><img src="[*titleImage*]" /></div>';
}
return $output;
?>
Called in the template as [[displayImage]].
(I know I can use phx but it’s out of action at the moment - thanks)