Problems, need help? Have a tip or advice? Post it here.
4 posts Page 1 of 1
Hello,
I'm new to couchCMS. It is really great and easy for development with out and less knowledge of php. thanks for giving couchCMS.

Here I struggle with one of the following requirement.
i.e., I have to make a Repeatable inside repeatable

here is the structure

example
    - example 1
      - text
      - thumbImage
      - images
        - image 1
        - image 2
        - image 3
    - example 2
      - text
      - thumbImage
      - images
        - image 1
        - image 2
        - image 3
        - image 4


can you please give me solution for below code.

<cms:template title='Example' >
<cms:repeatable name='example'>
<cms:editable type='nicedit' toolbar='full' name='example_text' label='Text' />
<cms:editable type='image' name='example_thumb_image' label='Photo' show_preview='1' preview_width='75' input_width='100' col_width='150' />
<cms:repeatable name='example_gallery'>
<cms:editable type='image' name=example_gallery_image' label='Photo' show_preview='1' preview_width='75' input_width='100' col_width='150' />
</cms:repeatable >
</cms:repeatable >


**************************************************************

<cms:show_repeatable 'example' >

<cms:show example_text />
<div class="gal">
<cms:show_repeatable 'example_gallery' >

<a class="fancybox-thumbs" rel="fancybox-thumb" href=" <cms:show example_gallery_image />"> <input type="image" name="submit" value="submit" src="<cms:show example_thumb_image />" /> </a>

</cms:show_repeatable >

</div>
</cms:show_repeatable >

I'm anticipating for your reply

thanks,
Prabu
Hi Prabu :)

Unfortunately repeatable-regions cannot be nested.

As an alternative, I'd suggest the following solution -
I see that you are using the template in a non-clonable manner.
My suggestion is to make the template clonable and define the regions as follows -
Code: Select all
<cms:template title='Example' clonable='1'>
    <cms:editable type='richtext' toolbar='full' name='example_text' label='Text' />
    <cms:editable type='image' name='example_thumb_image' label='Photo' show_preview='1' preview_width='75' input_width='100' col_width='150' />
   
    <cms:repeatable name='example_gallery'>
        <cms:editable type='image' name=example_gallery_image' label='Photo' show_preview='1' preview_width='75' input_width='100' col_width='150' />
    </cms:repeatable >
</cms:template>

So now each row in the, now removed, repeatable-region would now be represented by a cloned page instead.

Create cloned-pages for every row.
On the front-end, the display code would become as follows (I'm assuming the template's name is 'example.php')-
Code: Select all
<cms:pages masterpage='example.php'>
    <cms:show example_text />
    <div class="gal">
        <cms:show_repeatable 'example_gallery' >
        <a class="fancybox-thumbs" rel="fancybox-thumb" href=" <cms:show example_gallery_image />"> <input type="image" name="submit" value="submit" src="<cms:show example_thumb_image />" /> </a>
        </cms:show_repeatable >
    </div>
</cms:pages>

One drawback to this approach, as compared to repeatable-regions, is that you cannot move the cloned-pages up and down easily (i.e. manually reorder them).
This problem can be rectified by using the following addon - viewtopic.php?f=8&t=9577

So now you'll have an equivalent of your original solution.

Hope it helps. Do let me know.
I would suggest you to go with KK Sir's post, that is a really good solution.

Dear Prabhu,

It is not possible to have a nested repeatable structure and that is set by the design.

Seeing your code I suppose you want to create a gallery. Please share the code of it and we will try to retrofit Couch into your existing HTML code to get your gallery up and running.

Otherwise, you can also try the native Gallery feature of Couch. (LINK: http://docs.couchcms.com/concepts/photo-gallery.html)
and then created a nested gallery out of it (LINK: http://www.couchcms.com/forum/viewtopic.php?f=8&t=8559)

Hope the above solution ill help you, else you can share the HTML and we will get the rest done.

Regards!
Image
where innovation meets technology
Thankyou KK for your valuable solution. It's solve my problem :)
4 posts Page 1 of 1