Forum for discussing general topics related to Couch.
3 posts Page 1 of 1
Hi there,

Im just getting a handle on this CMS. Totally stoked on it. I was wondering....I like the editable image for the blog section..If there is a post which I do not want an image, can I do that? Or will there always be a place holder?

Thanks

Greg
Hi,

Suppose the name of the image type editable region is 'my_image'. As you already know, if we select an image into this editable region, the path of the image gets stored into it.
We then usually use the image's stored path this way -
<img src="<cms:show my_image />" />

If we do not select any image into this editable region, nothing gets stored into it - i.e. it remains empty.
We can, therefore, first check if there is anything at all within 'my_image' and if it is not empty we can display the image. The statement we used above to display the image can be wrapped around by a condition this way -
Code: Select all
<cms:if my_image >
   <img src="<cms:show my_image />" />
</cms:if>

This way we output an HTML 'img' tag only there is any image selected into the editable region.

Hope this answers your question.
thank you! works great
3 posts Page 1 of 1