[solved] FEUser - checking if an image has been set?
Posted: Sun May 18, 2008 7:11 am
Hi there,
I have an optional image property defined in Front end user. I need to check in my smarty templates whether this property has been set when displaying the user info, but haven't managed to do this successfully. I'll give an example. Assuming the smarty variable is called $photo I tried
I thought this should be the right test as {$photo|print_r} returns the filename when the photo has been set and nothing when it hasn't.
The problem is that even when no photo has been set the {if photo==""} returns true and the html source produced contains
But {if noset($photo)} does not work either as the variable is actually set.
I would appreciate any ideas how to check this.
Thanks
Gillian
I have an optional image property defined in Front end user. I need to check in my smarty templates whether this property has been set when displaying the user info, but haven't managed to do this successfully. I'll give an example. Assuming the smarty variable is called $photo I tried
Code: Select all
{if $photo==""}
<img src="{$gCms->config.uploads_url}/feusers/{$photo}" alt="no photo available"/>
{else}
<img src="{$gCms->config.uploads_url}/feusers/defaultuser.jpg" alt="no photo available"/>
{/if}
The problem is that even when no photo has been set the {if photo==""} returns true and the html source produced contains
Code: Select all
<img src="my_root_url/feusers/<noset>" alt="no photo available"/>
I would appreciate any ideas how to check this.
Thanks
Gillian