Results 1 to 7 of 7

Thread: adding feature to gAjax RSS Feeds Displayer

  1. #1
    Join Date
    Jul 2010
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Smile adding feature to gAjax RSS Feeds Displayer

    1) Script Title: gAjax RSS Feeds Displayer (hosted)

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...sdisplayer.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:


    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.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 ?
    Last edited by jscheuer1; 07-04-2010 at 09:09 AM. Reason: remove unnecessary link

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Setup an interval:

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

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Jul 2010
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by jscheuer1 View Post
    Setup an interval:

    Code:
    <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
    Last edited by down4me; 07-04-2010 at 10:44 AM.

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by down4me View Post
    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.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Jul 2010
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    First i would like to thank you for your help

    i want to say that when i place this code :

    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 :

    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

    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

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    If it's working like that without my added code, you can add it here:

    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
    
    setInterval(function(){socialfeed.init();}, 1000 * 60 * 60);
    
    </script>
    
    <br /><br />
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  7. The Following User Says Thank You to jscheuer1 For This Useful Post:

    down4me (07-04-2010)

  8. #7
    Join Date
    Jul 2010
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Thank you very much

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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •