Results 1 to 3 of 3

Thread: RSS Display Boxes help

  1. #1
    Join Date
    Feb 2009
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default RSS Display Boxes help

    1) Script Title:
    RSS Display Boxes

    2) Script URL (on DD):
    http://www.dynamicdrive.com/dynamici...ybox/index.htm

    3) Describe problem: I have placed the rss display box on my site but the box won't display the feed. it works with the defaut feeds that comes with it but when i put my own feeds in it won't display it. i am using wordpress to generate my feeds. i did manage to get it working with a .atom feed but i have to manually update it.

    here is the main.php file
    PHP Code:
    <?php
    //Function for ouputting the body of each RSS item displayed (inside loop)- DynamicDrive.com

    require('../simplepie/simplepie.inc'); //Specify path to simplepie.inc on your server (by default located inside "simplepie" directory)
    $feed = new SimplePie();
    $feed->cache_location('cache'); //Specify path to cache directory on your server relative to this file
    $feed->handle_content_type();
    require(
    'outputbody.php'); //Path to custom "outputbody.php" file relative to this file

    //Specify list of RSS URLs
    $rsslist=array(
    "centralbsu" => "http://centralbsu.com/blog/?feed=rss2",
    "bsublog" => "www.centralbsu.com/rss.atom" //no trailing comma after last RSS URL!!
    );

    ////Beginners don't need to configure past here. Edit outputbody.php to format the output of each RSS item's body ////////////////////

    $rssid=$_GET['id'];
    $rssurl=isset($rsslist[$rssid])? $rsslist[$rssid] : die("<b>Error:</b> Can't find requested RSS in list.");
    $cachetime=isset($_GET["cachetime"])? (int)$_GET["cachetime"] : 30//Get cachetime. Default to 30 if not specified
    $feednumber=isset($_GET["limit"])? (int)$_GET["limit"] : ""//Get number of items to fetch. If not specified (""), all is fetched.

    $templatename=isset($_GET["template"])? $_GET["template"] : ""//get name of template, which is used by if/else logic within function outputbody()
    if ($templatename!="" && !preg_match("/^(\w|-)+$/i"$templatename)) //Template name can only contain alphanumeric characters, underscore or dash (-)
    die ("<b>Error:</b> Template name can only consist of alphanumeric characters, underscore or dash");

    $feed->cache_max_minutes($cachetime);
    $feed->feed_url($rssurl);
    $feed->init();
    $max $feed->get_item_quantity($feednumber);


    function 
    outputitems(){
    global 
    $feed$feednumber$templatename;
    $max $feed->get_item_quantity($feednumber);
    for (
    $x 0$x $max$x++){
    $item $feed->get_item($x);
    outputbody($item$templatename); //call custom outputbody() function
    }
    }

    ?>

    <?php
    if ($feed->data){
    outputitems();
    }

    ?>
    here is the link to the site the box is on
    http://www.centralbsu.com
    Last edited by ddadmin; 02-19-2009 at 02:04 AM.

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Per the code on your HTML page, you're attempting to call the RSS feed with ID "cssdrive":

    Code:
    var cssdrivebox=new rssdisplaybox("cssdrive", "cssdriveid", "someclass")
    Inside main.php. there doesn't seem to be a RSS feed with that ID, however. That's because attempting to call: http://www.centralbsu.com/rssbox/main.php?id=cssdrive returns an error. Make sure it's defined.
    DD Admin

  3. The Following User Says Thank You to ddadmin For This Useful Post:

    ciuchs (02-19-2009)

  4. #3
    Join Date
    Feb 2009
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Thanks a lot! I would have never been able to figure it out, even though it was sitting right in front of me.

    CIuchs

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
  •