View Full Version : RSS Display Boxes - Select which category to display

06-15-2011, 07:46 AM
1) Script Title: RSS Display Boxes

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex18/rssdisplaybox/rssdisplaybox.zip

3) Describe problem: This is actually not a problem, your scripts work perfectly fine, and I must say, it is a great tool, thank you very much for developing and sharing it :D
Now my issue is that, instead of displaying all the RSS elements, Im trying to display only some of certain category. So, for example, the RSS has the following categories: News and Sports. Im trying to display only the news category in your boxes.
I have located the loop that stores the RSS feeds in the array, it is located in the rssbox/rssdisplaybox.js file. The function that performs the loop is:

var rssdivtags=document.getElementById(this.boxid).getElementsByTagName("div") //find all div tags within RSS display box
this.pieces=[] //define array to hold items
for (var i=0; i<rssdivtags.length; i++){ //loop thru the div tags
if (rssdivtags[i].className=="rsscontainer")
this.pieces[this.pieces.length]=rssdivtags[i] //store each RSS item DIV inside array
this.pagecount=Math.ceil(this.pieces.length/this.uchunksize) //calculate number of pages needed to show the items
for (var i=0; i<this.pieces.length; i++)
this.pieces[i].style.display="none" //Hide all items to begin with as we figure out which should be shown per the page selected
this.chunksize=(this.uchunksize>0 && this.uchunksize <this.pieces.length)? this.uchunksize : this.pieces.length //Determine TRUE "chunk size" (# of items to show per page)
this.pagecount=Math.ceil(this.pieces.length/this.chunksize) //calculate number of "pages" needed to show the chunks
this.showpage(-1) //show no pages (aka hide all)
this.currentpage=0 //Having hidden all pages, set currently visible page to 1st page
this.showpage(this.currentpage) //Show first page
if (this.chunksize!=this.pieces.length) //if pagination links are indeed needed
document.getElementById(this.paginatedivid).style.display="none" //else, hide pagination div user has erroneously created

Now, what Iīm trying to do is store in the rssdivtags[] array only the feeds with the "News" category and spare the other categories. The problem is I donīt know how to get the category information on the feeds. I was hoping there would be something like:
instead of


I would really appreciate your help on this.

Thanks in advance.