PDA

View Full Version : adding feature to gAjax RSS Feeds Displayer



down4me
07-04-2010, 08:03 AM
1) Script Title: gAjax RSS Feeds Displayer (hosted)

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

3) Describe problem:

It is said that i can refresh contents on the fly, without reloading the page. by calling instance.init() again. For example:




<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.filterfeed(6, "label") //Show 6 entries, sort by label
socialfeed.init() //Always call this last

</script>

<a href="javascript:socialfeed.init()">Refresh Feed Contents</a>


is there any way that this function is called dynamically every hour so the content is renewed without manual refresh ?

jscheuer1
07-04-2010, 09:12 AM
Setup an interval:


<script type="text/javascript">
setInterval(function(){socialfeed.init();}, 1000 * 60 * 60);
</script>

down4me
07-04-2010, 09:33 AM
Setup an interval:


<script type="text/javascript">
setInterval(function(){socialfeed.init();}, 1000 * 60 * 60);
</script>

page do not load after adding the code it gives HTTP500 internal server error

jscheuer1
07-04-2010, 12:12 PM
page do not load after adding the code it gives HTTP500 internal server error

Well, the code I gave you does nothing until after an hour. So, if you got that error before 1 hour of having the page up, the internal server error you received is from some other cause.

down4me
07-04-2010, 01:22 PM
First i would like to thank you for your help

i want to say that when i place this code :


<script type="text/javascript">
setInterval(function(){socialfeed.init();}, 1000 * 60 * 60);
</script>

in my script page it gives internal server error , when i remove the code the page loads fine

i have to say how did i installed the script as i have installed it in different way because i am using a script in my website i have installed it as follows :

1) i placed this code :


<script type="text/javascript" src="http://www.google.com/jsapi?key=YOUR-API-KEY">
</script>

<script type="text/javascript" src="gfeedfetcher.js">

/***********************************************
* gAjax RSS Feeds Displayer- (c) Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

</script>

<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 />

in the page where i want the rss feed to be displayed

2) i placed this code



.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 a{ /*CSS specific to demo 3*/
color: #D80101;
text-decoration: none;
font-weight: bold;
}

#example3 p{ /*CSS specific to demo 3*/
margin-bottom: 2px;
}

code{ /*CSS for insructions*/
color: red;
}

in the css file of my script

now it works fine i just want to load the function socialfeed.init() dynamically every hour so where should i place the code ( in which page ) ?

when i place it in the same page having the code in step one it gives internal server error

sorry for my long questions and thank you very much

Regard

jscheuer1
07-04-2010, 01:36 PM
If it's working like that without my added code, you can add it here:


<script type="text/javascript" src="http://www.google.com/jsapi?key=YOUR-API-KEY">
</script>

<script type="text/javascript" src="gfeedfetcher.js">

/***********************************************
* gAjax RSS Feeds Displayer- (c) Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

</script>

<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

setInterval(function(){socialfeed.init();}, 1000 * 60 * 60);

</script>

<br /><br />

down4me
07-04-2010, 02:15 PM
Thank you very much

now it works fine but with the code like that
setInterval("socialfeed.init()", 1000 * 60 * 60);