Home XML and RSS gAjax RSS Feeds Displayer Developer's View
<html>
<head>
<script src="http://yui.yahooapis.com/3.18.1/build/yui/yui-min.js"></script>
<script type="text/javascript" src="gfeedfetcher.js">
/***********************************************
* gAjax RSS Feeds Displayer- (c) Dynamic Drive (www.dynamicdrive.com)
* Please keep this notice intact
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/
</script>
<style type="text/css">
.labelfield{ /*CSS for label field in general*/
color:brown;
font-size: 90%;
}
.datefield{ /*CSS for date field in general*/
color:gray;
font-size: 90%;
}
#example1 li{ /*CSS specific to demo 1*/
margin-bottom: 4px;
}
#example2 div{ /*CSS specific to demo 2*/
margin-bottom: 5px;
}
#example2 div a{ /*CSS specific to demo 2*/
text-decoration: none;
}
#example3{ /*CSS specific to demo 3*/
width: 600px;
padding: 4px;
border: 1px dashed gray;
}
#example3 p{ /*CSS specific to demo 3*/
margin-bottom: 2px;
}
code{ /*CSS for insructions*/
color: red;
}
</style>
</head>
<body>
<h3>Example 1: (Single RSS feed, 10 entries, "<code>date</code>"
field enabled, sort by <code>title</code>)</h3>
<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") //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.init() //Always call this last
</script>
<br /><br />
<h3>Example 2: (Two RSS feeds, 6 entries, "<code>label"</code>,
"<code>datetime</code>", and "<code>snippet</code>" fields enabled, sort by
<code>label</code>)</h3>
<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.init() //Always call this last
</script>
<br /><br />
<h3>Example 3: (Three RSS feeds, 8 entries, "<code>datetime</code>" and
"<code>snippet</code>" fields enabled, sort by <code>date</code>)</h3>
<script type="text/javascript">
var newsfeed=new gfeedfetcher("example3", "example3class", "_new")
newsfeed.addFeed("BBC",
"http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss.xml")
//Specify "label" plus URL to RSS feed
newsfeed.addFeed("MSNBC",
"http://www.msnbc.msn.com/id/3032091/device/rss/rss.xml") //Specify "label" plus
URL to RSS feed
newsfeed.addFeed("CNN", "http://rss.cnn.com/rss/cnn_topstories.rss") //Specify
"label" plus URL to RSS feed
newsfeed.displayoptions("datetime snippet") //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
</script></body>
</html>