SimplePie Helper
|
Aug 21, 2008 07:59
72 posts
|
To insert RSS feed in a Frog page, you can use a helper. <pre><code> <?php<br /> use_helper('simplepie');</p> $feed = new SimplePie('http://simplepie.org/blog/feed/'); // or your rss url<br /> $feed->handle_content_type();<br /> ?> <p> <h1><a href="<?php echo $feed->get_permalink(); ?>"><?php echo $feed->get_title(); ?></a></h1><br /> <p><?php echo $feed->get_description(); ?></p> <?php<br /> foreach ($feed->get_items() as $item):<br /> ?><br /> <div class="item"><br /> <h2><a href="<?php echo $item->get_permalink(); ?>"><?php echo $item->get_title(); ?></a></h2><br /> <p><?php echo $item->get_description(); ?></p><br /> <p><small>Posted on <?php echo $item->get_date('j F Y | g:i a'); ?></small></p><br /> </div><br /> <?php endforeach; ?></code></pre> (I hope Markdown will be ok...) or |
|
Aug 21, 2008 08:00
72 posts
|
Maybe one day I'll understand Markdown... (link is OK) |
|
Aug 21, 2008 08:23
396 posts
|
@oweb - about markdown... I make sure to put an empty line before and after my code blocks and make sure to insert at least six spaces before each line of code... that usually seems to work. |
|
Aug 21, 2008 08:27
72 posts
|
I will do that next time... Thank's |
|
Aug 21, 2008 09:04
820 posts
|
mvdkleijn wrote "...insert at least six spaces...", or a single tab-character, which is what I do. (We'll sort this forum thing someday!!) |
|
Aug 21, 2008 09:09
820 posts
|
Btw - Oweb - did you see Ricks's post in the plugin forum? |
|
Aug 21, 2008 09:14
72 posts
|
No I didn't... Sorry |
|
Aug 21, 2008 09:18
820 posts
|
:) No need to apologize! If someone has only a single page pulling RSS, using Simplepie as a "Helper" might be a good solution! Thanks for this! |
|
Aug 21, 2008 09:20
820 posts
|
P.S for some reason the version of the link with the trailing |
|
Aug 21, 2008 09:29
820 posts
|
It took me a little while to find where/how to set multiple feeds. This is straight off the SimplePie site:
So that's how. :) |
|
Aug 21, 2008 10:33
72 posts
|
Do you mean like this ? |
|
Aug 21, 2008 11:09
820 posts
|
Oui - comme ça! :) Do you know how (or if) SimplePie can group the RSS feeds under their source? Something like:
I hope I got that Markdown right!! |
|
Aug 21, 2008 12:17
72 posts
|
I think it's easy... http://tech.groups.yahoo.com/group/simplepie-support/message/1268 |
|
Aug 21, 2008 16:02
286 posts
|
interesting. i'm a little confused though as to when to put stuff in the helpers folder and when to make it a plugin. anyone? |
|
Aug 21, 2008 16:15
276 posts
|
I think helpers are more for simple tasks. The are like addons, with no backend feature. When you talk about plugin in Frog, you mean more a extension, because with it you can extend the backend and the frontend, making it much more complex then a helper. |
|
Aug 21, 2008 16:15
820 posts
|
I think plugins are site-wide, and helpers work per-page. mvdkleijn explained them, and I believe him. :) |
|
Aug 21, 2008 16:39
820 posts
|
So if you wanted to use SimplePie across several pages in a site, then you would want the plugin version in preference to the helper version. I think. |