Problems, need help? Have a tip or advice? Post it here.
7 posts Page 1 of 1
Hi KK,
I created a gallery using the mosaic feature so I can be able to show images and videos. What I want to be able to do now is only the show the gallery section ONLY when at least an image or video has been uploaded. I did this but it's not working:
Code: Select all
<cms:capture into='show_news_gallery'>
   <cms:show_mosaic 'news_gallery' limit="1">
    <cms:if k_tile_name='image' >
                                <div class="single-item">
                                <img src="<cms:show image />" alt="">
                                </div>
                                </cms:if>


                                <cms:if k_tile_name='video_audio' >
                                <cms:do_shortcodes> <cms:show video_audio /></cms:do_shortcodes>
                                </cms:if>
     </cms:show_mosaic>
                            </cms:capture>

<cms:if "<cms:not_empty news_gallery_images />" >
... Show gallery here
</cms:if>


Any help will be appreciated. Thank you
Hi,

I think that is because you are capturing the output in one variable (show_news_gallery) but are testing a different one (news_gallery_images) for being not empty.

Does that help?
Hi KK,
Thanks for the quick response. It was an oversight. However I corrected the mistake but still getting the same result.

Code: Select all
<cms:capture into='show_news_gallery'>
   <cms:show_mosaic 'news_gallery' limit="1">
    <cms:if k_tile_name='image' >
                                <div class="single-item">
                                <img src="<cms:show image />" alt="">
                                </div>
                                </cms:if>


                                <cms:if k_tile_name='video_audio' >
                                <cms:do_shortcodes> <cms:show video_audio /></cms:do_shortcodes>
                                </cms:if>
     </cms:show_mosaic>
                            </cms:capture>

<cms:if "<cms:not_empty show_news_gallery />" >
... Show gallery here
</cms:if>
<cms:not_empty> strips all HTML tags from the contents before the test - this makes it unsuitable for use-cases where the entire content comprises of only HTML tags (with no plain text within them) as nothing would remain after the tags are stripped off.

This seems to be what is happening in your case.

Please try using <cms:strlen /> tag instead e.g. -
Code: Select all
<cms:if "<cms:strlen show_news_gallery />" >
... Show gallery here
</cms:if>

Hope this helps.
Yepeeeeee, thanks KK it worked like magic and I've learnt something new. I just encountered another issue. In one of the posts I deleted all the mosaic items and tried saving the post again but I got this message which is strange to me:
Could not successfully run query: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1

Any reason why that happened? Thanks for your support all the time.
Which version of Couch are you using?
Could you please try using the 2.2x available form GitHub? It is likely to have fixes for older issues.
Ok I will do that and let you know. Thanks once more.
7 posts Page 1 of 1

Who is online

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

Users browsing this forum: Google [Bot] and 6 guests