<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SoliTech GmbH &#187; MagpieRSS</title>
	<atom:link href="http://www.solitechgmbh.com/tag/magpierss/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.solitechgmbh.com</link>
	<description>Connecting businesses to people through effective online marketing strategy</description>
	<lastBuildDate>Thu, 13 May 2010 19:14:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>How to use MagpieRSS with CakePHP</title>
		<link>http://www.solitechgmbh.com/2009/07/23/how-to-use-magpierss-with-cakephp/</link>
		<comments>http://www.solitechgmbh.com/2009/07/23/how-to-use-magpierss-with-cakephp/#comments</comments>
		<pubDate>Thu, 23 Jul 2009 20:54:49 +0000</pubDate>
		<dc:creator>Gyuri</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[MagpieRSS]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.solitechgmbh.com/?p=507</guid>
		<description><![CDATA[MagpieRSS is a PHP based RSS parser that can be downloaded here http://magpierss.sourceforge.net/ What good is it you ask? You can use it to pull in information from any RSS feed and do what ever you want with the data. For example I use it to pull the RSS feed from my blog and display ...<br /><a href="http://www.solitechgmbh.com/2009/07/23/how-to-use-magpierss-with-cakephp/">Read more...</a>]]></description>
			<content:encoded><![CDATA[<p>MagpieRSS is a PHP based RSS parser that can be downloaded here <a href="http://magpierss.sourceforge.net/" target="_blank">http://magpierss.sourceforge.net/</a></p>
<p>What good is it you ask? You can use it to pull in information from any RSS feed and do what ever you want with the data. For example I use it to pull the RSS feed from my blog and display links to my latest posts on <a title="http://www.rewardchamp.com/" href="http://www.rewardchamp.com/" target="_blank">http://www.rewardchamp.com</a> You can see it on the bottom of the page.</p>
<p>CakePHP makes this way to easy! First you need to download the MagpieRSS files from the link above and then extract to your vendors folder.</p>
<p>You need to put this line at the very top of your controller file you want to use RSS with. Before the class declaration</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">App<span style="color: #339933;">::</span><span style="color: #004000;">import</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Vendor'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'Snoopy'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;file&quot;</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;magpierss/extlib/Snoopy.class.inc&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Now inside a function you want create a new Snoopy object. I use Snoopy because I&#8217;m lazy &#8230; MagpieRSS is not constructed as Classes like CakePHP would like it to be &#8230; Snoopy is. Snoopy will return XML for you which you can make into an easily usable object with SimpleXMLElement. You can var_dump to see what exactly is in this object. You can figure out what to do from there.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$snoopy</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Snoopy<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$snoopy</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">fetch</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'http://www.solitechgmbh.com/your/feed/here'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$xml</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> SimpleXMLElement<span style="color: #009900;">&#40;</span><span style="color: #000088;">$snoopy</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">results</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">return</span> <span style="color: #000088;">$xml</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">channel</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #339933;">;</span></pre></div></div>

<p>Something like this will get you the title for example.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">echo</span> <span style="color: #000088;">$item</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">title</span><span style="color: #339933;">;</span></pre></div></div>

<p>Happy coding!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.solitechgmbh.com/2009/07/23/how-to-use-magpierss-with-cakephp/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
