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.

showing alternate channel content if no results

December 21, 2010 9:17am

Subscribe [3]
  • #1 / Dec 21, 2010 9:17am

    bikuta

    118 posts

    Hi guys,

    Here’s what I’m trying to do:
    - I’ve got a channel which has upcoming content, i.e., events. However at time there may be no upcoming events.
    - So in the case when there are no upcoming events, I’d like to show an alternative content from another channel.

    I tried to use the no_results conditional, but it doesn’t seem to like the exp:entries tag in there. Unless I’m not doing it right.

    Any suggestions would be appreciated.

    Cheers.

  • #2 / Dec 21, 2010 10:23am

    Focus Lab Dev Team

    1129 posts

    I tried to use the no_results conditional, but it doesn’t seem to like the exp:entries tag in there. Unless I’m not doing it right.

    Yea, it’s not going to like you putting a entries loop within another entries loop. I’d say use the {if no_results} conditional and put an embedded template in there.

  • #3 / Dec 28, 2010 11:17pm

    bikuta

    118 posts

    Cool thanks!
    This would work for the scenario where there is 0 related entries.

    I’m also trying to make this work by limiting the total number of events shown.
    So if I need to limit it to 3 events it could show 1 event which is related to the channel and show 2 other events that are not related.
    As for other permutations of 2 related and 1 non-related, etc.

    Any suggestions?

  • #4 / Jan 03, 2011 9:03am

    bikuta

    118 posts

    Anyone?

  • #5 / Jan 03, 2011 1:20pm

    PhilBrienesse

    187 posts

    not sure if this will work but its worth a shot

    {if absolute_results < '3'}
      {embed="templategroup/template"}
    {/if}
  • #6 / Jan 03, 2011 11:52pm

    bikuta

    118 posts

    How do I make sure the embed happens after all the current entries have been processed?

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

ExpressionEngine News!

#eecms, #events, #releases