@mediaguy I’ve done similar things recently and what you want to do is build a snippet-widget to style the output of the TV.
I assumed you wanted to link to the image and not to a document. If you want to link to a document the following won’t be necessary and you can just style it in the template. BUT if you are wanting to link to the image itself, here you go:
I’d only use one TV and make it an image widget. I try to make it so clients never have to think about what they are doing. There is a tutorial in the public wiki but I’ll explain it here since it helps me remember these things as this is a very powerful little method.
So create your TV and make it of the type image. But don’t put the TV call in the template. For the sake of this I’ll use the TV name "
img_tv".
Then create a snippet to get the contents of the TV like so:
<?php
$tvArray = $modx->getTemplateVarOutput(array('img_tv'));
$img = $tvArray[img_tv];
if (empty($img)){
$output = '';
}
else {
$output = '<a href="'.$img.'"><img src="'.$img.'" /></a>';
}
return $output;
?>
Name the snippet
img_tv_snip.
Place your snippet call in your template [[tv_img_snip]].