SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: Blog Feed Issue

  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2011
    Posts
    48
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Blog Feed Issue

    Hello

    I am designing a website for my DJing and have been trying to work out how to connect it to my blog.

    I have followed instructions on http://www.dynamicdrive.com/dynamici...ybox/index.htm which was recommended to me but I end up with an Internal Server Error - see http://jameswinfield.co.uk/charts.html

    Does anyone know what I have done wrong? I only have HTML5/CSS3 experience and this was using other stuff like JS I think.

    Please excuse the imperfect design, it is only a template for now until I have the content sorted.

    Thanks
    James

  2. #2
    SitePoint Member
    Join Date
    Oct 2006
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Since in your javascript code you have things like "showbbc", I assume you didn't make all of the modifications needed to this script to show the data you want to show. I think we're going to need to see more of your code, since some of it is in PHP.

    Did you check the feed list that is supposed to be located at "rssbox/main.php" to see if it has the correct feed URLs?
    Check Out Syntaxxx.com - HTML5, CSS3, PHP, jQuery & More

  3. #3
    SitePoint Enthusiast
    Join Date
    Oct 2011
    Posts
    48
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I think it is right?

    Code PHP:
    <?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(
    "cssdrive" => "http://www.cssdrive.com/index.php/news/rss_2.0/",
    "bbc" => "http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss.xml",
    "nytimes" => "http://www.nytimes.com/services/xml/rss/nyt/HomePage.xml",
    "blog" => "http://jameswinfielddj.blogspot.co.uk/feeds/posts/default?alt=rss",
    "dynamicdrive" => "http://www.dynamicdrive.com/export.php?type=new" //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();
    }
     
    ?>
    Last edited by TechnoBear; Jan 20, 2014 at 13:03. Reason: Code tags added


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
  •