Grow your CSS skills. Land your dream job.

Custom SimplePie Favicons

  • # June 19, 2009 at 5:20 pm

    So I’ve been able to get all of the feed content with this code:

    Code:
    // Require SimplePie
    require_once(‘simplepie.inc’);

    // Initialize new feed
    $feed = new SimplePie(array(
    ‘http://twitter.com/statuses/user_timeline/18450439.rss’,
    ‘http://iethan.posterous.com/rss.xml’,
    ‘http://api.flickr.com/services/feeds/photos_public.gne?id=36044296@N07&lang=en-us&format=rss_200′,
    ‘http://vimeo.com/iethan/likes/rss’,
    ‘http://feeds.delicious.com/v2/rss/ethan.turkeltaub?count=15′,
    ‘http://www.dopplr.com/traveller/iEthan/feed/96de3a3152674b4bbf7a0c67c8cfee1200c40acc5b88de152bac9a77bbcaecda’
    ));
    $feed->init();

    // Create a new array to hold data in
    $new = array();

    // Loop through all of the items in the feed
    foreach ($feed->get_items() as $item) {

    // Calculate 24 hours ago
    $yesterday = time() – (24*60*60);

    // Compare the timestamp of the feed item with 24 hours ago.
    if ($item->get_date(‘U’) > $yesterday) {

    // If the item was posted within the last 24 hours, store the item in our array we set up.
    $new[] = $item;
    }
    }

    // Loop through all of the items in the new array and display whatever we want.
    foreach($new as $item) {
    echo ‘

    ‘;
    echo ‘
    ‘ . $item->get_date(‘M j, Y’) . ‘ – ‘ . $item->get_date(‘H:i:s’) . ‘

    ‘;
    echo ‘

    ‘;
    echo ‘

    ‘;
    }

    Now, for each of those feeds, I need to designate a custom favicon. How would I do this?

    # June 19, 2009 at 7:20 pm

    I don’t understand what you mean by "designate a custom favicon". Each feed has a favicon. You can access this using $item->feed->get_favicon() if that is what you mean.

    To display the favicon in html you can use:

    Code:
    echo ‘
    # June 19, 2009 at 10:04 pm

    I mean so that instead of the normal favicon, I can make it so that certain feeds have favicons I have on my site. So, say it was a Twitter update. I would need to get that icon from my site, instead of the normal one.

    # July 26, 2009 at 1:29 am

    Anybody find an answer to this? I would love it if I could have custom icons for each different feed… I’ve been searching everywhere, but the only thing I could find was in this crappy yahoo group forum: http://tech.groups.yahoo.com/group/simp … ssage/2184

    Any help would be greatly appreciated, I’m starting to go crazy!!! Thanks :)

    # July 27, 2009 at 3:35 pm

    Anyone have even the slightest idea on how to do this??

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".