Problems, need help? Have a tip or advice? Post it here.
3 posts Page 1 of 1
I am using the code below for a clonable template. When a template doesn't have an image nothing seems to display. If it has at least one image then everything displays how it should. Not sure where I am going wrong:

Code: Select all
<cms:capture into='my_buffer'>
                        <cms:show_repeatable 'menu'>
                           <div class="menu-details cute-6-tablet min-248">
                              <h2><cms:show item_name /> - <cms:show item_price /> <span></span></h2>
                              <p>
                                 <cms:show item_desc />
                              </p>
                              <cms:if "<cms:not_empty item_img />">
                                 <a href="<cms:show item_img />" class="menu-link mag-pop" title="<cms:show item_name />">
                                    <i class="fa fa-camera"></i> SEE WHAT IT LOOKS LIKE!
                                 </a>
                                 <cms:set show_buffer='1' 'global' />
                              </cms:if>
                           </div>
                        </cms:show_repeatable>
                     </cms:capture>
                     <cms:if show_buffer ><cms:show my_buffer /></cms:if>

Hi,

Your code seems to be doing exactly what it is supposed to do - that is, buffer everything temporarily and show it only if there is at least one non-empty image. Take a look at how you are signalling the buffer to be shown upon finding a non-empty image -
Code: Select all
<cms:if "<cms:not_empty item_img />">
    ...
    <cms:set show_buffer='1' 'global' />
</cms:if>
If no image is found, the buffer is never shown.

So, it appears to be a case of a logical error as opposed to a perceived bug in the tag.
I think what you want is simply the following -
Code: Select all
<cms:show_repeatable 'menu'>
   <div class="menu-details cute-6-tablet min-248">
      <h2><cms:show item_name /> - <cms:show item_price /> <span></span></h2>
      <p>
         <cms:show item_desc />
      </p>
      <cms:if "<cms:not_empty item_img />">
         <a href="<cms:show item_img />" class="menu-link mag-pop" title="<cms:show item_name />">
            <i class="fa fa-camera"></i> SEE WHAT IT LOOKS LIKE!
         </a>
      </cms:if>
   </div>
</cms:show_repeatable>

Does this help?
This helps a lot. Thanks KK. I just needed to get out of my own way lol
3 posts Page 1 of 1