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 to display specific weblog category entries in RSS Feed?

September 16, 2010 6:23pm

Subscribe [4]
  • #1 / Sep 16, 2010 6:23pm

    Is it possible? I have a “mixed” feed from different weblogs. For the “has-oido” weblog, I want to bring in entries from only one of the categories. Category ID is 23.

    Code below:

    {assign_variable:master_weblog_name="notitas-de-noticias|financial-blog|hsn-network|muy-intersante|por-que|immigration|has-oido"}
    {exp:rss:feed weblog="{master_weblog_name}"}
    
    <?xml version="1.0" encoding="{encoding}"?>
    <rss version="2.0"
        xmlns:dc="http://purl.org/dc/elements/1.1/"
        xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
        xmlns:admin="http://webns.net/mvcb/"
        xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
        xmlns:content="http://purl.org/rss/1.0/modules/content/">
    
        <channel>
        
        <title>{exp:xml_encode}Hispanically Speaking News Newsletter Feed{/exp:xml_encode}</title>
        <link>http://www.hispanicallyspeakingnews.com</link>
        <description>Daily on-line newspaper delivering breaking news about and for U.S. Hispanics with commentary, Latin American content, special focus on Chicago Hispanic News.</description>
        <dc:language>{weblog_language}</dc:language>
        <dc:creator>{email}</dc:creator>
        <dc:rights>Copyright {gmt_date format="%Y"}</dc:rights>
        <dc:date>{gmt_date format="%Y-%m-%dT%H:%i:%s%Q"}</dc:date>
        <admin:generatorAgent rdf:resource="http://expressionengine.com/" >
        
    {exp:weblog:entries weblog="{master_weblog_name}" rdf="off" dynamic_start="on" disable="member_data|trackbacks" show_future_entries="no" display_by="day"}
        <item>
          <title>{exp:xml_encode}{title}{/exp:xml_encode}</title>
          <link>{title_permalink={weblog_short_name}/details}</link>
          <guid>{title_permalink={weblog_short_name}/details}#When:{gmt_entry_date format="%H:%i:%sZ"}</guid>
    
          <description>      
          <![CDATA[
    
    {if weblog_short_name == "notitas-de-noticias"}
          {if image}<a href="http://{title_permalink=notitas-de-noticias/details}">{image}</a>{/if}
          {exp:word_limit total="60"}{body}{/exp:word_limit} <a href="http://{title_permalink=notitas-de-noticias/details}">Read More Here</a>
          <em>Published in <a href="http://{site_url}{weblog_short_name}">{weblog}</a></em>
    
    {if:elseif weblog_short_name == "financial-blog"}
          {if image}<a href="http://{title_permalink=financial-blog/details}">{image}</a>{/if}
          {exp:word_limit total="60"}{body}{/exp:word_limit} <a href="http://{title_permalink=financial-blog/details}">Read More Here</a>
          <em>Published in <a href="http://{site_url}{weblog_short_name}">{weblog}</a></em>
    
    {if:elseif weblog_short_name == "hsn-network"}
          {if image}<a href="http://{title_permalink=hsn-network/details}">{image}</a>{/if}
          {exp:word_limit total="60"}{body}{/exp:word_limit} <a href="http://{title_permalink=hsn-network/details}">Read More Here</a>
          <em>Published in <a href="http://{site_url}{weblog_short_name}">{weblog}</a></em>
    
    {if:elseif weblog_short_name == "muy-intersante"}
          {if image}<a href="http://{title_permalink=muy-intersante/details}">{image}</a>{/if}
          {exp:word_limit total="60"}{body}{/exp:word_limit} <a href="http://{title_permalink=muy-intersante/details}">Read More Here</a>
          <em>Published in <a href="http://{site_url}{weblog_short_name}">{weblog}</a></em>
    
    {if:elseif weblog_short_name == "por-que"}
          {if image}<a href="http://{title_permalink=por-que/details}">{image}</a>{/if}
          {exp:word_limit total="60"}{body}{/exp:word_limit} <a href="http://{title_permalink=por-que/details}">Read More Here</a>
          <em>Published in <a href="http://{site_url}{weblog_short_name}">{weblog}</a></em>
    
    {if:elseif weblog_short_name == "immigration"}
          {if image}<a href="http://{title_permalink=immigration/details}">{image}</a>{/if}
          {exp:word_limit total="60"}{body}{/exp:word_limit} <a href="http://{title_permalink=immigration/details}">Read More Here</a>
          <em>Published in <a href="http://{site_url}{weblog_short_name}">{weblog}</a></em>
    
    {if:elseif weblog_short_name == "has-oido"}
          {if image}<a href="http://{title_permalink=has-oido/details}">{image}</a>{/if}
          {exp:word_limit total="60"}{body}{/exp:word_limit} <a href="http://{title_permalink=has-oido/details}">Read More Here</a>
          <em>Published in <a href="http://{site_url}{weblog_short_name}">{weblog}</a></em>
    {/if}
          ]]>
          </description>
          <dc:subject>{exp:xml_encode}{categories backspace="1"}{category_name}, {/categories}{/exp:xml_encode}</dc:subject>
          <dc:date>{gmt_entry_date format="%Y-%m-%dT%H:%i:%s%Q"}</dc:date>
        </item>
    {/exp:weblog:entries}
        
        </channel>
    </rss>
    
    {/exp:rss:feed}
  • #2 / Sep 16, 2010 8:00pm

    Jarrett Barnett

    31 posts

    Well considering that your performing an {exp:weblog:entries} loop, you should easily be able to add the “category” parameter to filter your results to a specific category.

    So…

    {exp:weblog:entries 
        weblog="{master_weblog_name}" 
        rdf="off" 
        dynamic_start="on" 
        disable="member_data|trackbacks" 
        show_future_entries="no" 
        display_by="day"
        category="23"
    }

    See for other parameters (or more details on the category parameter): http://ellislab.com/expressionengine/user-guide/modules/channel/parameters.html#par_category

  • #3 / Sep 16, 2010 8:05pm

    Jarrett,

    That’s not gonna work. {master_weblog_name} refers to the top variable line {assign_variable:master_weblog_name="notitas-de-noticias|financial-blog|hsn-network|muy-intersante|por-que|immigration|has-oido"}

    Look at the “items” code again, I’m pulling entries from many different weblogs into one feed, but only need to pull one category from the “has-oido” weblog.

    Martin

  • #4 / Sep 16, 2010 9:09pm

    Jarrett Barnett

    31 posts

    Ahh I see, so only category filtering within the “has-oido” weblog.


    To keep it somewhat simple (and not too messy), you could try adding another template and embed it in place of your output.

    1) For example, modify your feed conditional to:

    {if:elseif weblog_short_name == "has-oido"}
          {embed="group/template" entry_id="{entry_id}"}
    {/if}

    2) Then in the template you embeded, you can run another {exp:weblog:entries} output:

    {exp:weblog:entries entry_id="{embed:entry_id}" category="23" limit="1" disable="member_data|trackbacks" dynamic="off"}
    
    {if image}<a href="http://{title_permalink=has-oido/details}">{image}</a>{/if}
          {exp:word_limit total="60"}{body}{/exp:word_limit} <a href="http://{title_permalink=has-oido/details}">Read More Here</a>
          <em>Published in <a href="http://{site_url}{weblog_short_name}">{weblog}</a></em>
    
    {/exp:weblog:entries}
  • #5 / Sep 17, 2010 10:00am

    Ingmar

    29245 posts

    Does that help, L.C.?

  • #6 / Sep 17, 2010 4:05pm

    Jarrett and Ingmar,

    I changed the code, it’s working *but* it is still trying to pull the “has-oido” entries outside of the category=“23”. When it does it, it’s not displaying them correctly either, ie. no links, no description text, image, etc.

    On the RSS page you’ll see these near the top - link: http://www.hispanicallyspeakingnews.com/home/newsletter-rss-feed

    EVENT:  (Logan Square) Fall Bicycle Tours
    September 17, 2010 10:23 AM
    CRIME: (Logan Square) Ice Pick Kidnapper Captured
    September 17, 2010 10:13 AM
    COMMUNITY:  GED Coaching in Logan Square
    September 17, 2010 10:05 AM
    COMMUNITY:  Video on 26th St Independence Day Parade
    September 17, 2010 9:56 AM

    Those are the “has-oido” entries from other categories, not displayed correctly.

    It did display the one entry from yesterday correctly if you search for “Samba and Save your Marriage at the Same Time” near the bottom of the page. This is the entry from “has-oido” and category=“23”

    Any idea how to block all other categories from displaying completely?

    The only other change I made is in this line, I’ve added limit=“2” to display entries from today and yesterday.

    {exp:weblog:entries weblog="{master_weblog_name}" rdf="off" dynamic_start="on" disable="member_data|trackbacks" show_future_entries="no" display_by="day" limit="2"}

    Everything else I followed Jarrett’s suggestion.

    {if:elseif weblog_short_name == "has-oido"}
          {embed="home/newsletter-rss-feed-has-oido" entry_id="{entry_id}"}
    {/if}

    and the embedded template

    {exp:weblog:entries entry_id="{embed:entry_id}" category="23" limit="1" disable="member_data|trackbacks" dynamic="off"}
    
    {if image}<a href="http://{title_permalink=has-oido/details}">{image}</a>{/if}
          {exp:word_limit total="60"}{body}{/exp:word_limit} <a href="http://{title_permalink=has-oido/details}">Read More Here</a>
          <em>Published in <a href="http://{site_url}{weblog_short_name}">{weblog}</a></em>
    
    {/exp:weblog:entries}
  • #7 / Sep 17, 2010 6:11pm

    Guys,

    I was playing with the template, and got rid of the “has-oido” references, but it’s back to what I posted above now.

    Martin

  • #8 / Sep 19, 2010 3:41pm

    Greg Salt

    3988 posts

    Hi Lunchbox Creative,

    I don’t think you can do this with the weblog:entries tag in this way. Have you considered using the Query module to grab the exact data you want to display in the feed?

    Cheers

    Greg

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

ExpressionEngine News!

#eecms, #events, #releases