Problems, need help? Have a tip or advice? Post it here.
4 posts Page 1 of 1
I'm very new to Couch - it seems fantastic.

But I am struggling with links and pages.

I have a complete site which I am retrofitting Couch to - just what it is designed for.

I have created repeating regions for a slider so that the client can add and remove slides etc. Great.
I have also made another page completely editable, but on the original html site, I had four pictures that linked to other pages, it is this I can't seem to work out.

I'm sure it is very simple but I can't find what I need – how do I attach a link to an image that has been created via an editable region on a page that links to another page?

Thanks
Hi,

I think you are having trouble attaching links to images uploaded via repeatable-region.

The standard way would be to define a field for the link along with the field for image e.g.
Code: Select all
<cms:repeatable name='images'  >
    <cms:editable name='my_image' label='Image' type='image'  />
    <cms:editable name='my_link' label='Link of the page attached to the image' type='text' />
</cms:repeatable>

Now the original HTML with image linked to a page e.g.
Code: Select all
<a href="page.html" ><img src="image.jpg" /></a>
would become -
Code: Select all
<a href="<cms:show my_link />" ><img src="<cms:show my_image />" /></a>

Obviously, the same technique could be used for normal (i.e. non-repeatable) images in the template.

Hope this helps.
Thanks KK

I knew it would be simple.

Taking it a stage further, if the image with the link points to a page that does not exist yet, can I give the page a logical name I want, and then later on when the page is generated via the CMS cloned pages option can I then specify the name of the page there.

Sorry if I'm jumping about but I'm working through the tutorial bit by bit that matches my requirements as I go…

My next stage is to make a 'product' page that these links will point to that will be clonable, then I will back track and finish the blog tutorial and hopefully it will all fit together.

Does that make sense?
if the image with the link points to a page that does not exist yet, can I give the page a logical name I want, and then later on when the page is generated via the CMS cloned pages option can I then specify the name of the page there.
Sure. You can put whatever you like - Couch will faithfully output anything it finds in the textbox.
4 posts Page 1 of 1