Could any one show me how to use simplepie

Discussion in 'HTML & Website Design' started by jimmy123, Feb 20, 2010.

  1. #1
    Could anyone show me how to make website like popurl by using simplepie. I want it to be nofollow on each link and open in a new window.
    Thanks in advance.
     
    jimmy123, Feb 20, 2010 IP
  2. broxen

    broxen Peon

    Messages:
    60
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    do you use cms or you build your own PHP page?
     
    broxen, Feb 20, 2010 IP
  3. jimmy123

    jimmy123 Peon

    Messages:
    177
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Which is better? if I want to build PHP is there a good tutorial to do it?
    thank you
     
    jimmy123, Feb 21, 2010 IP
  4. broxen

    broxen Peon

    Messages:
    60
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    broxen, Feb 21, 2010 IP
  5. jimmy123

    jimmy123 Peon

    Messages:
    177
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5
    jimmy123, Feb 21, 2010 IP
  6. broxen

    broxen Peon

    Messages:
    60
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    you din't need plugin to deal with simplepie in wordpress 2.8 and above.:)
    just need to add the function to the page you desired to add the feed.
     
    broxen, Feb 21, 2010 IP
  7. jimmy123

    jimmy123 Peon

    Messages:
    177
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #7
    could you show me how to do it?
    thanks
     
    jimmy123, Feb 22, 2010 IP
  8. broxen

    broxen Peon

    Messages:
    60
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    here's simple usage for single feed.
    for muntiple feed, you need to declare array on function fetch_feed:
    
    	<?php // Get RSS Feed(s)
    	include_once(ABSPATH . WPINC . '/feed.php');
    
    	// Get a SimplePie feed object from the specified feed source.
    	$rss = fetch_feed('http://www.somesite.com/feed/');
    
    	// Figure out how many total items there are, but limit it to 5. 
    	$maxitems = $rss->get_item_quantity(5); 
    
    	// Build an array of all the items, starting with element 0 (first element).
    	$rss_items = $rss->get_items(0, $maxitems); 
    	?>
    
        <?php if ($maxitems == 0) echo '<li>No items.</li>';
        else
        // Loop through each feed item and display each item as a hyperlink.
    		foreach ( $rss_items as $item ) : ?>
    			<h3><a href='<?php echo $item->get_permalink(); ?>' 
    //the rss post title as link
    			title='<?php echo $item->get_title(); ?>'>
    //use content as title for link
    			<?php echo $item->get_title(); ?></a></h3>
    			<p><?php echo $item->get_date('j F Y | g:i a'); ?></p>
    //date and time of post here
    
    		<?php endforeach; ?>
    
    PHP:
    feel free to remove comment if it trigger any error :)
     
    broxen, Feb 22, 2010 IP
  9. Jarod B

    Jarod B Peon

    Messages:
    9
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Wow, Ill use that code myself lol. It's actually GREAT!
     
    Jarod B, Feb 22, 2010 IP
  10. jimmy123

    jimmy123 Peon

    Messages:
    177
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #10

    Thanks so much. I am still learning about php. Could you show me how to put multiple feeds as well?
     
    jimmy123, Feb 23, 2010 IP
  11. broxen

    broxen Peon

    Messages:
    60
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    change this line:
    $rss = fetch_feed('http://www.somesite.com/feed/');
    PHP:
    to an array
    $rss = fetch_feed(array(
    	'http://somesite.com/feed/',
    	'http://anothersite.com/feed/',
            'and so on'));
    PHP:
     
    broxen, Feb 24, 2010 IP
  12. jimmy123

    jimmy123 Peon

    Messages:
    177
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #12
    Thanks so much. I will try it.
     
    jimmy123, Feb 24, 2010 IP
  13. broxen

    broxen Peon

    Messages:
    60
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #13
    you're welcome..:)

    though I will write free ebook for this :D
     
    broxen, Feb 24, 2010 IP
  14. jimmy123

    jimmy123 Peon

    Messages:
    177
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #14
    that's a good idea, probably I'll buy your book :)
     
    jimmy123, Feb 26, 2010 IP
  15. jimmy123

    jimmy123 Peon

    Messages:
    177
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #15
    I have more questions here. How do I know if this follow or nofollow? since I would like it to be nofollow.
    thanks in advance.
     
    jimmy123, Mar 1, 2010 IP