Problems, need help? Have a tip or advice? Post it here.
4 posts Page 1 of 1
Hello,
I have a request from a client whose site I am maintaining in Couch. This is regarding a list of art exhibitions. Each exhibition is a collection of images, which I output using the repeatable widget.
Now she has requested a new change: to output the images in two separate sections on the front end. The first section will contain all the paintings and the new second section will contain photographs and invites of the show (under a heading Exhibition Memorabilia).
So I decided to add a new dropdown field to the repeatable, with a title called
"Is Exhibition Memorabilia" with 2 options: Yes | No option. I have provided No as the default selected option (since that will include all the paintings).
However, it isn't working as expected.

I have pasted the code below. I'm sure I'm doing something silly; any help will be appreciated.
Code: Select all
    <cms:repeatable name='work_each' order='4' stacked_layout='1'>
      <cms:editable
        name='work_each_img'
        label='Work Image'
        type='image'
        width='1000'
        show_preview='1'
        preview_width='100'
      />   

      <cms:editable
        name="work_each_memorabilia"
        label="Exhibition Memorabilia"
        desc="Is this Exhibition Memorabilia?"
        opt_values='Please Select=- | No | Yes'
        opt_selected='No'
        type='dropdown'
        col_width='100'
        input_width='100'
        required="1"
      />
  </cms:repeatable>


Code: Select all
<cms:extends 'base.html' />

<cms:block 'main'>
  <cms:if k_is_page>
    <cms:if work_each_memorabilia= 'No'>
      <cms:show_repeatable 'work_each' >
        <div class="show-each">
          <img src="<cms:thumbnail work_each_img width='700' />" class="show-img">
        </div>
      </cms:show_repeatable>

      <cms:else />
        <h2>Event Photos &amp; Memorabilia</h2>
        <cms:show_repeatable 'work_each' >
          <img src="<cms:thumbnail work_each_img width='700' />" class="show-img">
        </cms:show_repeatable>
      </cms:if>
      <cms:else />
      <!-- This outputs the list view with all the exhibitions -->
  </cms:if>
</cms:block>

Hi Karen,

The 'work_each_memorabilia' editable-region is a child region of the repeatable 'work_each' and so would be available only within the repeatable-region block (and not outside it, as in your code).

Please try the following modification -
Code: Select all
<cms:extends 'base.html' />

<cms:block 'main'>
    <cms:if k_is_page>

        <cms:show_repeatable 'work_each' >
            <cms:if work_each_memorabilia = 'No'>
                <div class="show-each">
                    <img src="<cms:thumbnail work_each_img width='700' />" class="show-img">
                </div>
            </cms:if>
        </cms:show_repeatable>

        <h2>Event Photos &amp; Memorabilia</h2>
        <cms:show_repeatable 'work_each' >
            <cms:if work_each_memorabilia = 'Yes'>
                <img src="<cms:thumbnail work_each_img width='700' />" class="show-img">
            </cms:if>
        </cms:show_repeatable>
       
    <cms:else />
        <!-- This outputs the list view with all the exhibitions -->
    </cms:if>
</cms:block>

Hope this helps.
God bless you, KK. Seriously :)
This works and I shall keep this in mind next time.
Thank you, sincerely.
You are always welcome :)
4 posts Page 1 of 1