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 />

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

</cms:if>

But it doesnt seem to work.
Hi,

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>
</cms:if>

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=""/>
</cms:if>


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


Cheers


webecho
Hi,

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


webecho
7 posts Page 1 of 1
cron