ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

if:else inside a no_results condition

June 05, 2009 1:05pm

Subscribe [1]
  • #1 / Jun 05, 2009 1:05pm

    ericandrewscott

    12 posts

    why won’t the following code work? can i not do an {if:else} within an {if no_results}?

    <ul>
      {exp:weblog:entries weblog="press" orderby="date" sort="desc"}
        {if no_results}
          <li>There are no files available.</li>
        {if:else}
          <li>a link to the file</li>
        {/if}
      {/exp:weblog:entries}
    </ul>
  • #2 / Jun 05, 2009 1:07pm

    Lisa Wess

    20502 posts

    {if no_results} is a special variable pair, you can not use it with an if:else.  Nor do you need to - it is intrinsically thus.  It’s functionality is to show some content if there are no results, if:else show the actual data.

  • #3 / Jun 05, 2009 1:10pm

    ericandrewscott

    12 posts

    ohhhh…. duh! thank you!!! i should just put everything in the loop there, and obviously it won’t do it if there are no results. thanks again!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases