Error with SimplePie_Item extensions #377

pethr opened this Issue Sep 13, 2014 · 0 comments


None yet

1 participant

pethr commented Sep 13, 2014

SimplePie examples extending SimplePie_Item do not seem to work for me – f.e.

The first custom (prefixed) field causes "Fatal error: Call to a member function get_label() on a non-object in /Library/WebServer/Documents/simplepie_test3.php on line 26"

Any ideas how to fix this? Am I including the files wrong? Thanks for any help I have spent hours trying to make this work.

require_once ('/Library/WebServer/Documents/simplepie/autoloader.php');
require_once ('/Library/WebServer/Documents/simplepie/library/SimplePie/Item/Digg.php');

$feed = new SimplePie();

?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="" xml:lang="en" lang="en"> 
    <title>Sample Page to test SimplePie add-on for</title>

    <h1><a href="<?php echo $feed->get_permalink(); ?>"><?php echo $feed->get_title(); ?></a></h1>

    <?php foreach($feed->get_items() as $item): ?>

    <h3><img src="<?php echo $item->get_submitter_image(); ?>" alt="<?php echo $item->get_submitter_username(); ?>" title="<?php echo $item->get_submitter_username(); ?>" width="16" height="16" /> <a href="<?php echo $item->get_permalink(); ?>"><?php echo $item->get_title(); ?></a></h3>
    <p><?php echo $item->get_description(); ?></p>
    <p><small>Diggs: <?php echo $item->get_digg_count(); ?> | Submitted by: <?php echo $item->get_submitter_username(); ?> | Comments: <?php echo $item->get_comment_count(); ?> | Category: <?php $category = $item->get_category(0); echo $category->get_label(); ?> | <?php echo $item->get_date('l, F jS Y, g:i a'); ?></small></p>
    <hr />

    <?php endforeach; ?>

@pethr pethr changed the title from Fatal error with SimplePie_Item extensions to Error with SimplePie_Item extensions Sep 13, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment