Problems, need help? Have a tip or advice? Post it here.
6 posts Page 1 of 1
I've created a filterable gallery on my website that looks as below the following code. It works as expected and I was able to implement the first image to be edited with the couch admin. I'm able to select the image and the category tags in the class.

What I can't figure out is how to make the whole thing dynamic through couch so I can add images as I need them and not have a set number of spaces to fill.

Also is there a way to have the category section a checklist instead of a text field?

Any help much appreciated.



Hi Adam,

There are two solutions -
1. Use 'repeatable-regions' for your gallery - please see ... gions.html.

Define two fields within it - one type image' and the other a type 'checkbox' or type 'dropdown' to hold the categories.
This way you can add a variable number of images (by creating a new row for each) and also set its individual category.

2. If the number of images you'l eventually need will run into hundreds or more, then a better alternative would be use a clonable template. Define a type 'image' for the photo. Use the 'folders' feature available in all templates for the categories.

Using this method, each image will be given a separate cloned page.
The gallery feature ( makes this process a tad easier.

In closing, I think the first method above seems more suitable for your use-case. Please try that.
Let us know if you happen to need any help.
Hi KK,

Thanks for your help. That repeatable region solution worked perfectly!

I have another question. How would I then go about dynamically showing the first 3 images from this gallery on the home page? So that whenever images are added to the gallery it automatically updates on the homepage.

Look forward to your reply.
Glad it helped.

Replying to your new query -
the new features in v2.1 (specifically <cms:get_field> and the new parameters of <cms:show_repeatable>) should make it a snap to get that done -

Please try and let me know in case you happen to need some help.
Hi KK,

That's a cool new feature and looks like what I need. However I can't seem to get it to work.

In my projects.php code I have the following gallery setup:

Code: Select all
<div id="portfolio">
        <cms:show_repeatable 'my_projects' >
         <div class="tile" data-category="<cms:each img_categories ><cms:show item />, </cms:each>99">
            <img style="display:block;height:auto" src="<cms:show my_img />" alt="<cms:show my_alt />" />

And the following code at the top of the code:

Code: Select all
<cms:template title='Projects'>
   <cms:repeatable name='my_projects' stacked_layout='1' >
      <cms:editable type='image' name='my_img' label='Image' desc='Upload image below' show_preview='1' preview_width='200' />
      <cms:editable type='checkbox' name='img_categories' label='Categories' desc='Check all applicable categories' opt_values='identity=1 | print=2 | web=3' />
         <cms:editable type='text' name='my_alt' label='Description' desc='Image description' />

Then on the home page (index.php) where I want the gallery to display as well, I have the following code, which doesn't seem to be working:

Code: Select all
<cms:get_field 'my_projects' masterpage='projects.php' >
         <cms:show_repeatable 'my_projects' >

I know I'm missing something obvious, but I can't figure out what else I need to add. I've updated the CMS to 2.1 as well. Also, how do I make it show only X number of images and not all?
Nevermind, figured it out. Had to copy the contents repeatable region in both instances.
6 posts Page 1 of 1

Who is online

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

Users browsing this forum: Exabot [Bot] and 3 guests