OK, first of all, you didn't have to edit the script at all. The change you made/were trying to make, can be made using the feed instance definetemplate function. However, if you want all feeds to have this new template, you can change it in the script as you have already done, just do it correctly (as I'm about to explain).
The real mistake you made was to use feeds[i].link - which in the template has no meaning. What you want is the already available token {url}
So, for example, using the first example feed on the demo page we could do (using it's init, without editing the script at all, impotant additions highlighted):
Code:
<script type="text/javascript">
var cssfeed=new gfeedfetcher("example1", "example1class", "")
cssfeed.addFeed("CSS Drive", "http://www.cssdrive.com/index.php/news/rss_2.0/") //Specify "label" plus URL to RSS feed
cssfeed.displayoptions("date snippet") //show the specified additional fields
cssfeed.setentrycontainer("li") //Display each entry as a list (li element)
cssfeed.filterfeed(10, "title") //Show 10 entries, sort by date
cssfeed.definetemplate("<hr>{title} {label}<br />{date}<br />{description}<br /><br /><a href=\"{url}\">Read more...</a>") // output template for this RSS entry
cssfeed.init() //Always call this last
</script>
NOTES: By using the snippet as part of the displayoptions instead of description, we get a shorter version of the description. By defining the definetemplate here, we don't have to change the main script's outputtemplate string. Notice also the escaped (\") internal quotes for the template. It is always necessary in a code string to escape the like quotes which delimit the string. In this case it would be easier to do it this way:
Code:
cssfeed.definetemplate('<hr>{title} {label}<br />{date}<br />{description}<br /><br /><a href="{url}">Read more...</a>') // output template for this RSS entry
(using single quotes to delimit the string, allowing for unescaped double quotes inside the string), but either way works.
Here's another, perhaps better example (the snippets here are actually shorter, the css drive descriptions were short already):
Code:
<script type="text/javascript">
var socialfeed=new gfeedfetcher("example2", "example2class", "_new")
socialfeed.addFeed("Slashdot", "http://rss.slashdot.org/Slashdot/slashdot") //Specify "label" plus URL to RSS feed
socialfeed.addFeed("Digg", "http://digg.com/rss/index.xml") //Specify "label" plus URL to RSS feed
socialfeed.displayoptions("label datetime snippet") //show the specified additional fields
socialfeed.setentrycontainer("div") //Display each entry as a DIV
socialfeed.filterfeed(6, "label") //Show 6 entries, sort by label
socialfeed.definetemplate('<hr>{title} {label}<br />{date}<br />{description}<br /><br /><a href="{url}">Read more...</a>') // output template for each RSS entry
socialfeed.init() //Always call this last
</script>
Bookmarks