RSS feed for a particular category?
Posted: 06 August 2004 07:55 PM   [ Ignore ]  
Lab Assistant
Avatar
RankRank
Total Posts:  226
Joined  03-06-2003

I’m wondering if there’s a method to publish an RSS feed for a specific category of an EE weblog (rather than for the entire weblog).

Anyone know how to do this?

Profile
 
 
Posted: 06 August 2004 08:24 PM   [ Ignore ]   [ # 1 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  32162
Joined  05-14-2004

The RSS feeds utilize the exp:weblog container, so you’d just need to find the opening container and add category=“1” where 1 is the category ID. 

If you wanted to add an RSS template to do this you could “Add New Template” and tick the radio box to base it off a pre-existing template - then choose the RSS feed of your choice.  Make sure you also choose “RSS” in type.  Then just add the category the exp:weblog opening container, which will look something like:

{exp:weblog:entries weblog=“weblog1”  orderby=“date” sort=“desc” limit=“7”}

change it to read


{exp:weblog:entries weblog=“weblog1”  orderby=“date” sort=“desc” limit=“7” category=“1”}

I hope that helps!

 Signature 
Profile
MSG
 
 
Posted: 15 August 2004 03:50 AM   [ Ignore ]   [ # 2 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  112
Joined  09-15-2002

I can see that works for setting up an RSS template for one (category=“1”) category (sub-category). I have 3 main categories with 130 sub-categories.

Is there a way of setting up a single RSS template that would “transform” into the RSS feed of any particular category (or sub-category )when called from that same category page?

e.g.

I am on a page that is ... News > Japan
‘News’ is the parent and ‘Japan’ is the sub-category

So on the page that shows all the entries for Japan is there a way of setting up the RSS code so that when the RSS button is clicked it opens an RSS feed for Japan.

Likewise if I was the page showing say all entries for USA - again the RSS button would open up an RSS feed for USA postings.

I know I could do this by creating a unique RSS template for everyone of my 130 sub-categories - but is there a way to utilise a single RSS template by clever use of the EE code?

Thanks for any tips
Steve

Profile
 
 
Posted: 15 August 2004 10:23 AM   [ Ignore ]   [ # 3 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  9868
Joined  06-19-2002

This should be fairly easy to accomplish in v1.1 (you could do it in 1.0, but it would require more effort).  General approach in 1.1 would be:

1. Let’s say you set up your specific “category” RSS Template.  You have it at http://www.example.com/index.php/feeds/categoryrss/.


2. Inside that Template you would use something like this:

{exp:weblog:entries weblog="weblog1" orderby="date" sort="desc" limit="7" category="{segment_3}"}

That will dynamically pull the category value from the URL.


3. On your Template that displays the categories you’ll have your button for “RSS for this category” or something.  When you make the link you need to append the category ID to the end of the link.

What you use will depend on the exact syntax available in 1.1, but the general idea would be to do something like this:

<a href="{path=feeds/categoryrss}{category_id)">RSS for this category</a>


So… every category page would have a unique URL to the RSS template that included it’s category ID.  The RSS Template would just pull that ID out and use it to restrict the display.

 Signature 

Chris Curtis
chriscurtis.org

Profile
 
 
Posted: 15 August 2004 02:51 PM   [ Ignore ]   [ # 4 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  112
Joined  09-15-2002

Thanks Chris, that makes sense. I’ll try it out.

I guess v1.1 isn’t available yet to everyone. But I think I can make that work.

Mmmm… am curious about the {segment 3} thing - new stuff to learn wink

Thanks again
Steve

Profile
 
 
Posted: 01 September 2004 01:13 PM   [ Ignore ]   [ # 5 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  520
Joined  05-14-2004

Or you could do what I did and just cheat and run the category through your standard RSS template of choice merely by changing the path= parameter as follows:

{exp:weblog:categories weblog=“weblog1”}
<a href=”{path=weblog/rss_2.0}” title=“RSS 2.0 Category Feed”><img src=“XML.gif”></a> <a href=”{path=weblog/index}”>{category_name}</a>
{/exp:weblog:categories}

The drawback to this method is that the header part of the RSS feed that IDs your blog looks exactly the same as your standard RSS feed, but it is a quick and dirty way to get it done. I’m currently using this method on my blog.

 Signature 

“I was gratified to be able to answer promptly, and I did. I said I didn’t know.” - Mark Twain, Life on the Mississippi

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 10:33 AM
Total Registered Members: 62721 Total Logged-in Users: 49
Total Topics: 77334 Total Anonymous Users: 19
Total Replies: 417398 Total Guests: 249
Total Posts: 494732    
Members ( View Memberlist )
Newest Members:  jeffccaseyfamilyservicesAledVelindavearioRusspdtrigeminiRRecordbabunomada