Problems, need help? Have a tip or advice? Post it here.
3 posts Page 1 of 1
couch.jpg
couch.jpg (68.16 KiB) Viewed 41 times
couch.jpg
couch.jpg (68.16 KiB) Viewed 41 times
So i'm using the following code on my text...

Code: Select all
        
<cms:editable name='placemat_8' label='Placemat Image' type='image' quality='80'  show_preview='1'>       
        <img src="<cms:show placemat_8 />" alt=""/>     
        </cms:editable>


the problem is now that while the image shows up fine in the admin section.. it appears as TEXT on the actual page where the image should appear...

see attachement

I'm not sure what i'm doing wrong...
any help would be appreciated....
The cms:editable tag defines the region *and also* outputs its content on the front-end.
So, in a sense, your code is doing what it is supposed to do - i.e. output the path of the image.

You are not using its output correctly to set the 'src' attribute of the <img> tag.
As explained in the docs, there are two ways to do that -

1. Define the editable region at the exact spot where you wish to use its output. Your code will then become as follows -
Code: Select all
<img src="<cms:editable name='placemat_8' label='Placemat Image' type='image' quality='80'  show_preview='1' />" alt=""/>

2. Define the editable region at a separate location within <cms:template> (along with all other editable regions) and then use <cms:show> to output its content at the proper location. You code would then become something like this -
Code: Select all
<cms:template>
    <cms:editable name='placemat_8' label='Placemat Image' type='image' quality='80'  show_preview='1' />       
</cms:template>

Code: Select all
<img src="<cms:show placemat_8 />" alt=""/> 

Hope it helps.
Thanks a lot. Works perfectly now
3 posts Page 1 of 1

Who is online

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

Users browsing this forum: Bing [Bot] and 5 guests