PDA

View Full Version : gAjax RSS Feeds Displayer script customization



cxcskiing
07-05-2010, 10:06 PM
1) Script Title: gAjax RSS Feeds Displayer

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex18/gajaxrssdisplayer.htm

3) Describe problem: Thank you for the great script! My questions are more on script customization.

I'm using Example 2, and would like to know if the square bracket for the label can be removed or replaced by two forward slashes, for example.

Also, I understand the body of the RSS is a "snippet"... is the a way to modify how many characters are being displayed? is looks like the code displays the first sentence of the original post, and I'd like to extend it by at least one more sentence.

Thank you!

ddadmin
07-05-2010, 11:49 PM
Try the below attached .js file. It does two things:

1) Removes the square brackets from the labels: [label] is shown just as label
2) When the display option is set to "description" instead of "snippet", it displays the first 200 characters of the full description (after stripping it of any HTML tags). The display option is set in the following line inside your initialization code:


"
"
newsfeed.displayoptions("datetime description") //show the specified additional fields
newsfeed.setentrycontainer("p") //Display each entry as a paragraph
newsfeed.filterfeed(8, "date") //Show 8 entries, sort by date
newsfeed.init() //Always call this last


To change the 200 character limit to something else, inside the .js file, you'd change 200 below to another number:


itemdescription=itemdescription.replace(re, "").substring(0, 200)
if (itemdescription.length==200)
itemdescription+='...'

cxcskiing
07-06-2010, 01:59 PM
Thank you very much! I'll get to work right away :)

cxcskiing
08-09-2010, 02:47 PM
DD Admin,
I've originally used an example with two RSS feeds. If I wanted to have the script display one more or two more RSS feeds that'll be added to the mix, do I need to change this line:

var socialfeed=new gfeedfetcher("example2", "example2class", "_new")

to

var socialfeed=new gfeedfetcher("example3", "example3class", "_new")

plus add socialfeed.addFeed (); ?

Thank you,
Irina

cxcskiing
09-23-2010, 04:26 PM
Hello,
This time my question to you is this:
With RSS Feed Displayer script, I have:

<script type="text/javascript">

var socialfeed=new gfeedfetcher("example2", "example2class", "_new")
socialfeed.addFeed("CXC News", "http://...")
socialfeed.addFeed("CXC Elite Blog", "http:/...")
socialfeed.addFeed("CXC Adaptive News", "http:...")
socialfeed.displayoptions("label datetime description")
socialfeed.setentrycontainer("div") //Display each entry as a DIV
socialfeed.filterfeed(8, "label") //Show 6 entries, sort by label
socialfeed.init() //Always call this last

</script>

On the display priority list "CXC News" are #1, "CXC Elite Blog" is #2, and "CXC Adaptive News" is #3. The script, however, displays "CXC Adaptive News" first and "CXC News" last - I'm guessing basing it on alphabetical order. Is there any way to assign the order to the deeds?

Thanks a lot!
Irina

ddadmin
09-23-2010, 11:04 PM
Irina, in the future, please start a new thread when asking a new question, even about the same script.

To your question, sort by label is based on the ascending alphabetical order of the labels. I reckon you're asking how to sort by descending alphabetical order instead? If so, try finding the below line inside the .js file, and add to it the line in red:


gfeedfetcher._sortarray(feeds, this.sortstring)
feeds.reverse()