Parsing Rss Feed on a html page

Discussion in 'PHP' started by Riots, Jun 29, 2008.

  1. #1
    Hey all dp people out there. Well I really dont need hel parsing the feed. Using simplepie. I already have it working Graph ClothesI just want it to display a little bit more info. Not just Title and description. I want it to pull the dates and how many comments is possible. also i want to make the title smaller.thanks

    oh yeah here the current code I have in my news.php


     
    Riots, Jun 29, 2008 IP
  2. matthewrobertbell

    matthewrobertbell Peon

    Messages:
    781
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You need to find the methods for your $feed object that allow you to display the desired info.
     
    matthewrobertbell, Jun 30, 2008 IP
  3. shallowink

    shallowink Well-Known Member

    Messages:
    1,218
    Likes Received:
    64
    Best Answers:
    2
    Trophy Points:
    150
    #3
    get_date() is the function for the date. Comments isn't supported or I missed it on simplepie's API page:
    http://simplepie.org/wiki/reference/start

    According to the RSS 2 spec, it supports a comment URL but not displaying the # of comments. feedburner I believe adds the # of comments but it is in the description. Maybe customize the generation of your feeds to add it.

    
    echo '<h3 class="rssheader"><a href="'.$item->get_permalink().'">';
    echo $item->get_title().'</a></h3> <div class="rssdate">' . $item->get_date() .'</div>';
    echo '<p>'.$item->get_description().'</p>';
    
    Code (markup):
    Then define .rssheader { font-size: 1.1em; } in your stylesheet. Odds are I would wrap the entire thing in a div and drop the class for the h3, if you defined the div as class .rssfeed. It could be accessed as .rssfeed h3 to modify the header. And would give more options to style the rest of the feed box.
     
    shallowink, Jun 30, 2008 IP
    Riots likes this.
  4. Riots

    Riots Active Member

    Messages:
    374
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    83
    #4
    all right cool thanks for the info ill give this a try.. im a little confused but Ill give it a shot..
     
    Riots, Jun 30, 2008 IP