Working with Combined Weblogs

Have you ever run into a situation where you had content stored in separate ExpressionEngine weblogs, but then wanted to use one weblog:entries loop to pull content from those separate weblogs?  EE lets you pipe in more than one weblog name in the weblog parameter on the weblog entries tag, and I wanted to show a few ways to work with that.

All the code snippets used in the screencast are available at the end of this post.  Enjoy!

 

 

 

3 Weblogs, 3 Weblog:Entries Tags:

<h1>Colors Separate</h1>
<
font color="red">
<
h2>Red</h2>
<
ul>
    
{exp:weblog:entries weblog="red"}
        
<li>{title}</li>
    
{/exp:weblog:entries}
</ul>
</
font>

<
font color="blue">
<
h2>Blue</h2>
<
ul>
    
{exp:weblog:entries weblog="blue"}
        
<li>{title}</li>
    
{/exp:weblog:entries}
</ul>
</
font>

<
font color="green">
<
h2>Green</h2>
<
ul>
    
{exp:weblog:entries weblog="green"}
        
<li>{title}</li>
    
{/exp:weblog:entries}
</ul>
</
font


3 Weblogs Piped into 1 Weblog:Entries Tag

<h1>Colors Mixed</h1>
<
ul>
    
{exp:weblog:entries weblog="red|blue|green"}
        
<li><font color="{weblog_short_name}">{title}</font></li>
    
{/exp:weblog:entries}
</ul


3 Weblogs, 1 Weblog Entries Tag with Pagination

<h1>Colors Mixed and Paginated</h1>
<
ul>
    
{exp:weblog:entries weblog="red|blue|green" pagination="bottom" limit="3"}
        
<li><font color="{weblog_short_name}">{title}</font></li>

        
{paginate}
            
<p>Page {current_page} of {total_pages} pages {pagination_links}</p>
        
{/paginate}

    {
/exp:weblog:entries}

</ul


3 Weblogs, 1 Weblog:Entries Tag with Per-Weblog Fields

<h1>Colors Mixed and Pulling Per-Weblog Fields</h1>
<
ul>
    
{exp:weblog:entries weblog="red|blue|green"}
        
<font color="{weblog_short_name}">
            <
strong>{title}</strong>
            
{red_content}
            {blue_content}
            {green_content}
        
</font>
        <
hr />
    
{/exp:weblog:entries}

</ul


3 Weblogs, 1 Weblog:Entries Tag with Weblog-Specific Links

<h1>Colors Mixed with Weblog-Specific Links</h1>
<
ul>
    
{exp:weblog:entries weblog="red|blue|green"}
        
<li><a href="{comment_url_title_auto_path}"><font color="{weblog_short_name}">{title}</font></a></li>
    
{/exp:weblog:entries}

</ul


Example Detail Template for Above Code

<font color="blue">
{exp:weblog:entries weblog="blue"}
    
<h2>{title}</h2>
    
{blue_content}
{
/exp:weblog:entries}
</font

Category Navigation

<< Previous Entry   

Next Entry >>

 

Previous Comments

Picture of John Knotts

by John Knotts

Date: Saturday, September 19th, 2009
Comment: #1

Good stuff, thanks Mike!

Picture of vinay

by vinay

Date: Saturday, September 26th, 2009
Comment: #2

Nice one Mike. Can you explain if there is an easy way to order by weblog with piped weblogs.

Mike Boyink

by Mike Boyink (Author)

Date: Saturday, September 26th, 2009
Comment: #3

The whole point of piping weblogs is to merge them into one intermingled resultset. If that’s not what you want then just use seperate weblog entries loops. If you are concerned about maintaining more code create an embedded template and pass the weblog name in as an embedded variable.

Add Your Comment

Commenting is not available in this channel entry.

Unless otherwise stated all content is © Michael Boyink of Train-ee.com & Boyink Interactive. Please don't steal - I've got kids to feed...

dy>