Problems, need help? Have a tip or advice? Post it here.
7 posts Page 1 of 1
Im building up a blog and i want to show a img floated right of the text when in shown in summary mode. The code looks like this:

<span class="thumb"><img src="<cms:show blog_image />" /></span>
<cms:if "<cms:not_empty blog_image />" >

<cms:else />

<img src="<cms:show blog_image />" />


But it doesnt seem to work.

I think the code should simply be -
Code: Select all
<cms:if "<cms:not_empty blog_image />" >
   <span class="thumb"><img src="<cms:show blog_image />" /></span>

Please try it out and let me know.
Yeah that worked. Been messing with it all morning and it was that simple...
Glad it worked :)
Feel free to contact us if run into any further trouble.
Hi Guys
Thought this might make sense as an extension to this post.

I'm trying to do something similar, but using cms:editable.

Code is
Code: Select all
<cms:if "<cms:not_empty product_image />" >
<img class="product-image" src="<cms:editable name="product_image" width="504" type="image" show_preview="1"/>" alt=""/>

This works for NOT showing the image when it's not there, but has also removed the admin field to add an image in the first place.

I'm sure it's something simple, but I haven't managed to work it out yet - would be very grateful for a point in the right direction



When a page is executed by a super-admin, Couch checks to see if any of the defined editable regions have been modified. If a previously existing editable region is seen missing, Couch marks it as deleted.
With this explanation in mind, it should be easy to see that your code is causing the '<cms:editable ..' clause that defines a region to be skipped for the true 'if' condition. This makes Couch think that the region is no longer defined and hence mark it as deleted.

The way out is simply to define the editable region separately within the 'template' tag and then use the '<cms:show ../> tag to display its value within the 'if' condition. This way the true 'if' condition will only skip showing the value and not the act of defining the region.

Hope this answers your question.
Thanks KK
I knew there'd be a simple way around it - worked perfectly.

I'd realised that the if condition was hiding it, just couldn't figure out how to make sure it showed in admin.

Looking forward to really understanding this system - it's a great tool.

Thanks again

7 posts Page 1 of 1

Who is online

In total there are 16 users online :: 0 registered, 0 hidden and 16 guests
(based on users active over the past 5 minutes)

Users browsing this forum: No registered users and 16 guests