Hey
Kind of new to modx snippets so bear with me.
I'm trying to take a template variable named image_file and i'm trying to just output a message and display if it's there and if not then output an error.
Here is my snippet code named: image_snippet
<?php
$output = "";
$tv_value = $modx->getTemplateVar(array('image_file'),$docid='4');
if (!empty($tv_value['image_file']))
{
$output = '<img src="'.$tv_value['image_file'].'" />';
}
else
{
echo 'Nothing To Show';
}
return $output;
?>
This is the code in my template:
{{html_header}}
[*content*]
[[image_snippet]]
{{html_footer}}
I understand if else constructs and all that however I don't know why I can't get any output with tv_value;
Any help would be appreciated, been at this for days.
Thanks
Riz