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.

How can I call multiple weblogs into one {exp:weblog:entries} tag?

May 25, 2010 1:35pm

Subscribe [3]
  • #1 / May 25, 2010 1:35pm

    gogglez

    23 posts

    My client is asking me to make it so his home page will call 4 different weblogs into the same list, ordered by date. Is this even possible?

    Thanks for any help here.

    Steve

  • #2 / May 25, 2010 3:04pm

    Ingmar

    29245 posts

    Do you mean:

    {exp:weblog:entries weblog="foo|bar|spaz|splat" orderby="date"}

    ?

  • #3 / May 25, 2010 3:16pm

    gogglez

    23 posts

    I was able to find that, but… I guess this is kind of complicated.

    My issue now is that I can call those entries, and that works well. But I’m using word limiter plus, and the only way I could get the limiting working well creates this strange, ugly code:

    {exp:weblog:entries weblog="home|leadership|foodentertainment|green" dynamic="off" limit="8" show_future_entries="yes"}
                    <div class="content_item">
                        <h1><a href="http://{url_title_path=listings/index_detail}">{title}</a></h1>
                        {entry_date format="%F %j%S, %Y"} by {author}
                        {exp:word_limit_plus if_exceeds="200" stop_after="175" the_link="<a href='{title_permalink=listings/index_detail}'>Read more…</a>"}{Home}{/exp:word_limit_plus}<div class="clear"></div>
                        {exp:word_limit_plus if_exceeds="200" stop_after="175" the_link="<a href='{title_permalink=listings/leadership_detail}'>Read more…</a>"}{Leadership}{/exp:word_limit_plus}<div class="clear"></div>
                        {exp:word_limit_plus if_exceeds="200" stop_after="175" the_link="<a href='{title_permalink=listings/food_entertainment_detail}'>Read more…</a>"}{FoodEntertainment}{/exp:word_limit_plus}<div class="clear"></div>
                        {exp:word_limit_plus if_exceeds="200" stop_after="175" the_link="<a href='{title_permalink=listings/green_detail}'>Read more…</a>"}{Green}{/exp:word_limit_plus}
                    </div>
                {/exp:weblog:entries}

    So the problem that comes now is linking to the titles of the entries (They all link to ‘listings/index_detail’, so only the Home weblog’s titles are linked properly). Similarly, I want to be able to link to the comments of each entry as well.

    I’ve tried a few things, but I guess as you can imagine, it’s easy to make really weird stuff happen here. Is it possible to make this set up work, or is calling multiple weblogs a fairly limited feature?

    Thanks for getting back to me - I should have updated my question sooner.

  • #4 / May 26, 2010 3:15pm

    gogglez

    23 posts

    Is this a dead-end? I feel pretty hopeless, haha. I’ve goofed around so much to no avail.

  • #5 / May 26, 2010 8:03pm

    setheryb

    39 posts

    If I’m understanding correctly this is what you want.

    {exp:weblog:entries weblog="home|leadership|foodentertainment|green" dynamic="off" limit="8" show_future_entries="yes"}
                    <div class="content_item">
                        <h1><a href="http://{url_title_path=listings/index_detail}">{title}</a></h1>
                        {entry_date format="%F %j%S, %Y"} by {author}
    {if weblog_id == "n"}
                        {exp:word_limit_plus if_exceeds="200" stop_after="175" the_link="<a href='{title_permalink=listings/index_detail}'>Read more…</a>"}{Home}{/exp:word_limit_plus}<div class="clear"></div>
    {if:elseif weblog_id == "n"}
                        {exp:word_limit_plus if_exceeds="200" stop_after="175" the_link="<a href='{title_permalink=listings/leadership_detail}'>Read more…</a>"}{Leadership}{/exp:word_limit_plus}<div class="clear"></div>
    {if:elseif weblog_id == "n"}
                        {exp:word_limit_plus if_exceeds="200" stop_after="175" the_link="<a href='{title_permalink=listings/food_entertainment_detail}'>Read more…</a>"}{FoodEntertainment}{/exp:word_limit_plus}<div class="clear"></div>
    {if:elseif weblog_id == "n"}
                        {exp:word_limit_plus if_exceeds="200" stop_after="175" the_link="<a href='{title_permalink=listings/green_detail}'>Read more…</a>"}{Green}{/exp:word_limit_plus}
    {/if}
                    </div>
                {/exp:weblog:entries}

    Replace “n” in each instance with the corresponding weblog ID number. Let me know if this works for you.

  • #6 / May 26, 2010 8:11pm

    Lisa Wess

    20502 posts

    Or you could just use {comment_url_title_auto_path} and ditch the conditionals. =)

  • #7 / May 26, 2010 8:19pm

    setheryb

    39 posts

    Would that work if comments aren’t involved?

  • #8 / May 26, 2010 8:22pm

    Lisa Wess

    20502 posts

    Yes, you’re just setting up a per-weblog permalink, you don’t have to use comments to use it.  Try outputting it on the page and see what comes out to understand.

  • #9 / May 27, 2010 1:33pm

    gogglez

    23 posts

    The result I get is a link like: http://example.com/article_title_goes_here

    Where as I need it to say: http://example.com/template_group/template/article_title_goes_here

    Is there a way to automatically insert the template group and template name as well? I’m guessing I should use conditionals with the weblog id to determine which template group and template to use, but I thought I’d check here first.

    Thanks! I’m a step closer.

  • #10 / May 27, 2010 1:35pm

    setheryb

    39 posts

    The conditionals should work. But I’ll let Lisa answer about using the {comment_url_title_auto_path} method.

  • #11 / May 27, 2010 1:51pm

    Lisa Wess

    20502 posts

    gogglez - did you fill out the Comment URL path as explained in the docs for that variable? You’ll need to fill it out for this to work.  No conditionals needed, since that path is per weblog - it’s already a conditional.

  • #12 / May 27, 2010 2:11pm

    gogglez

    23 posts

    Ahhhh I apologize, I think I expected expressionengine to pull a rabbit out of its hat there. Once I set up the comment url paths properly, this worked perfectly. The final code ended up being really similar to what I started with too, which is kind of a relief.

    Everything is easy to do with expressionengine if you know how to do it, haha. Thanks a lot for your help.

  • #13 / May 27, 2010 2:14pm

    setheryb

    39 posts

    Ahh, I think I get it now. Awesome solution.

    Hey Lisa since you were so masterful at solving this solution, perhaps you might take a look at a thread of mine if you haven’t already?

    http://ellislab.com/forums/viewthread/156283/

    Thanks.

  • #14 / May 27, 2010 2:15pm

    Lisa Wess

    20502 posts

    Everything is easy to do with expressionengine if you know how to do it, haha.

    I remember having that same thought - but that was in 2004 when I first started. I promise, it does get easier.

    Glad you got it working!

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

ExpressionEngine News!

#eecms, #events, #releases