Hi Everyone!
I have a page where I want to display either a featured image or an image gallery in the left corner of a text block, which wraps around the image. Pretty basic.
If I use just a single image for the story, I have a class that shows a border around the image. If I decide to use a gallery (via a grid field), the images rotate, and the user can click on them to view larger versions. Also pretty simple.
The complication is evaluating whether either of the two is empty, and if so, show the one that has content. Further, if neither the gallery or single image have any content, show nothing.
My code is below. You can also view an example of what the single image is supposed to look like HERE. On the second page, I have the gallery set up, but nothing appears on the page when I load it HERE.
All this leads me to believe that there’s something I’m not doing correctly with the IF statements.
Thank you all for any help you can give!!
{exp:channel:entries channel="about" limit="1" sort="asc"}
<h class="headline">{if title != ""}{title}{/if}</h3><span class="line"></span><div class="clearfix"></div>
{if gallery_section:total_rows >= "1"}
<div class="five alt columns alpha">
<!-- FlexSlider -->
<section class="flexslider post-img">
<div class="media">
<ul class="slides mediaholder">
{gallery_section}
<li>
<a href="http://{gallery_section:about_image}%22class=%22mfp-gallery" title="{gallery_section:about_image_caption}" class="mfp-gallery">_ {gallery_section:about_image}_ <div class="hovercover">_ <div class="hovericon"><i class="hoverzoom"></i></div>_ </div>_ </a>
</li>
{/gallery_section}
</ul>
</div>
</section>
</div>
{if:elseif about_image_single}
{about_image_single}
{/if}
{about_full_body_text}
{if no_results} {redirect="404"} {/if}
{/exp:channel:entries}
I’m surprised by how dead this forum seems to be. I haven’t been back here in a while, and things have certainly changed quite a bit… :red:
At any rate, I figured out a solution to this, and wanted to post, in case others ran into the same issue.
It turns out, I had to code the opening conditional in the following format:
{if '{gallery_section:total_rows}' >= '1'}
Notice the single quotes and brackets.
I’m not sure if this is a bug, but everything seems to be working fine now.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.