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.

Group data from multiple weblogs

September 21, 2009 12:45pm

Subscribe [2]
  • #1 / Sep 21, 2009 12:45pm

    chpops

    33 posts

    Moderator’s note: Moved to Howto.

    Hi,
    I am pulling data from two weblogs, features and news:

    {exp:weblog:entries weblog="features|news" limit="1" search:news_featured="Yes"}

    I only want to show one featured item on my page but I want the features weblog to take precedence over the news weblog even if it an older entry i.e. a features entry should always take presidence over a news entry.

    How can I go about doing this? If I where using SQL I would use the groupby condition, is there anything similar in EE?

    Thanks in advance
    Gary

  • #2 / Sep 21, 2009 1:09pm

    Mark Bowen

    12637 posts

    I could be totally wrong on what I’m about to say but if you always have a features weblog entry then if you do as you are wanting then you would never even get the chance to see one of the news weblog entries?

    To that end (if I’m right in my thinking) then I’m a bit confused but if you don’t always have a features entry that satisfies that weblog search parameter then you might be able to do what you want in the following way :

    Main Template

    {exp:weblog:entries weblog="features" limit="1" search:news_featured="Yes"}
    
    <h2>{title}</h2>
    
    <p>{if no_results}<br />
    {embed="your_template_group/news_weblog_entry"}<br />
    {/if}</p>
    
    <p>{/exp:weblog:entries}

    your_template_group/news_weblog_entry

    {exp:weblog:entries weblog="news" limit="1" search:news_featured="Yes"}
    <h2>{title}</h2>
    <p>{/exp:weblog:entries}

    This way if there are no valid results for the first tag which just brings back the features weblog then the embedded template would run and thus bring back the news item instead.

    Not entirely certain if that’s what you’re after though because I may have completely misunderstood by what I mentioned above.

    Hope that does help a bit though.

    Best wishes,

    Mark

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

ExpressionEngine News!

#eecms, #events, #releases