Skip to content

Instantly share code, notes, and snippets.

@ucay
Created January 20, 2016 14:24
Show Gist options
  • Save ucay/1e2668aac8f9a37d9bfb to your computer and use it in GitHub Desktop.
Save ucay/1e2668aac8f9a37d9bfb to your computer and use it in GitHub Desktop.
CouchCMS - Empty Secure File Handler
<cms:pages masterpage='index.php'>
<!-- set default value for prevent using last variable in loop -->
<cms:set has_foto='0' 'global' />
<cms:show_securefile 'foto'>
<img src="<cms:cloak_url link=file_id />" alt="Image" /> <!-- show image -->
<cms:set has_foto='1' 'global' /> <!-- set variable image are not empty -->
</cms:show_securefile>
<!-- check if image is empty, then use default image-->
<cms:if "<cms:not has_foto />" >
<img src="<cms:show k_site_link />images/not-available.png" alt="Image Not Available" />
</cms:if>
</cms:pages>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment