1

I am wondering why this code isn't working as I expect it:

{exp:channel:entries search:feature_on_homepage="y" search:images="not IS_EMPTY"  disable="categories|member_data"}

I am expecting that only entries with Yes option selected and have images to be returned.

Thanks

1

If your “OFF Value” setting is blank, that should work, however that IS_EMPTY flag can be a little buggy because EE doesn’t factor in NULL values, which is exactly what all of your entries will have which haven’t been saved since you added the Switch field.

So rather than searching for "not IS_EMPTY", you might be better off searching for the “ON Value” setting explicitly. Assuming you left it at the default value of “y”, your parameter would be:

search:images="=y"
0

If you output the value of the field, what do you see? Does the field output 'y' or 'n' or does it output 'y' or blank?

If the former then your criteria will fail since search:images is never empty

3
  • Output is blank for P&T switch. I am not sure if I understand. Apart from a few, most entries have images. – Abs Jul 18 '13 at 13:31
  • Sorry, I have tested again: I have set some entries to Yes and some to No. The ones selected as Yes output "y" and the ones selected No output "Yes". – Abs Jul 18 '13 at 13:37
  • That sounds like something is set up incorrectly. – foamcow Jul 18 '13 at 14:47
0

Not sure if this will help but, Have you tried to echo out your result of the switch? to see what it's result is?

  {if pt_switch == 'y'}
<h1>{title}</h1>
    switch is set to yes
    {/if}

and the opposite

 {pt_switch}
    {if pt_switch != 'y'}
<h1>{title}</h1>
    switch is not to yes
    {/if}
0

This is not working actually. I use this code

{exp:channel:entries channel="clanci" limit="5" dynamic="no" status="open" show_future_entries="no" orderby="date" sort="desc" search:galerijaslika="=y" disable="pagination|member_data"}
                                        <div class="panel-gallery">
                                            <div class="gallery-images">

                                                <a href="#" class="gallery-navi-left icon-text">&#59229;</a>
                                                <a href="#" class="gallery-navi-right icon-text">&#59230;</a>
                                                <ul>
                                                    {exp:channel_images:images entry_id="{entry_id}"}
                                                    <li class="active"><a href="{site_url}art/{url_title}"><img src="{image:url:galerija_slika_300}" class="setborder" alt="{image:description}" title="{image:title}" /></a></li>
                                                    {/exp:channel_images:images}
                                                </ul>

                                            </div>
                                            <div class="gallery-header">
                                                <b><a href="{site_url}galerija/{url_title}">{title}</a></b>
                                            </div>
                                        </div>                  
                                        {/exp:channel:entries}

and even though i use search:galerijaslika="=y" it does not return anything and I know I have entries that use that switch and it works when I use it when opening entry but when I want to show lost of entries, then it is not working correctly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.