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.

Show Expired Entries if No Future Entries Exist

July 12, 2012 3:08pm

Subscribe [2]
  • #1 / Jul 12, 2012 3:08pm

    Geoff Towle

    330 posts

    I simply want to show expired entries in a channel if no future entries exist in the same channel. Can’t figure it out. Here’s my code so far…

    <ul class="list">
    {exp:weblog:entries weblog="seminars_temp|webinars|seminars|speaking" sort="asc" show_future_entries="no" show_expired="yes" limit="4" disable="categories|category_fields|member_data|pagination|trackbacks" status="open"}
     {if no_results}{/if}
     <li>
      <div class="info">
       {if weblog == "Webinars"}
        <a href="http://{path=%27events/webinars%27}" class="link grey"><span class="link grey">{weblog}</span><em></em></a>
       {if:elseif weblog == "Seminars"}
        <a href="http://{path=%27events/seminars%27}" class="link green"><span class="link green">{weblog}</span><em></em></a>
       {if:elseif weblog == "Seminars TEMP"}
        <a href="http://{url_title_path=%27seminars/event%27}" class="link green"><span class="link green">SEMINAR</span><em></em></a>
       {if:else}
        <a href="http://{path=%27events/speaking%27}" class="link ltgreen"><span class="link ltgreen">{weblog}</span><em></em></a>
       {/if}
       <em class="date">{entry_date format="%F %d, %Y"}</em>
      </div>
      <strong class="title">
       {if weblog == "Webinars"}
        <a href="http://{url_title_path=events/webinars}class=active">{title}</a>
       {if:elseif weblog == "Seminars"} 
        <a href="http://{url_title_path=events/seminars}class=active">{title}</a>
       {if:elseif weblog == "Seminars TEMP"} 
        <a href="http://{url_title_path=seminars/event}class=active">{title}</a>
       {if:else}
        <a href="http://{url_title_path=events/speaking}class=active">{title}</a>
       {/if}
      </strong>
     </li>
    {/exp:weblog:entries}
    </ul>
  • #2 / Jul 16, 2012 1:13pm

    Shane Eckert

    7174 posts

    Hey Geoff,

    There is no way to do this in one shot, like if X then Y but you could do this.

    Simplified for example.

    {exp:weblog:entries weblog="speaking" show_future_entries="yes"}
    {if no_results}
    EMBED HERE
    {/if}
    {/exp:weblog:entries}

    And in that embed would be

    {exp:weblog:entries weblog="speaking" show_expired="yes"}
    STUFF HERE
    {/exp:weblog:entries}

    Does that make sense?

    Cheers,

  • #3 / Jul 16, 2012 1:16pm

    Geoff Towle

    330 posts

    Hi Shane,

    Ah! I had tried to put a exp:weblog tag inside the no_results tag, but that didn’t work. I didn’t think about doing an embed. Does that work due to the parsing order?

    I’ll give it a shot this week and advise. Thanks.

    Geoff

  • #4 / Jul 17, 2012 1:45pm

    Shane Eckert

    7174 posts

    Hey Geoff,

    This should work. Parse Order should be good!

    Let me know how it goes!!

    Cheers,

  • #5 / Jul 18, 2012 2:20pm

    Geoff Towle

    330 posts

    Hi Shane,

    I was just about to say that it wasn’t working then I figured it out. So it’s working using the embed. Thanks!

  • #6 / Jul 18, 2012 5:38pm

    Shane Eckert

    7174 posts

    Hey Geoff,

    No problem! Glad things are all sorted.

    If you need anything else, please just let me know by opening a new thread.

    Cheers,

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

ExpressionEngine News!

#eecms, #events, #releases