<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[PunBB Forums — A news / xml custom page for users ...]]></title>
		<link>https://punbb.informer.com/forums/topic/8512/a-news-xml-custom-page-for-users/</link>
		<atom:link href="https://punbb.informer.com/forums/feed/rss/topic/8512/" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in A news / xml custom page for users ....]]></description>
		<lastBuildDate>Tue, 23 Aug 2005 11:41:40 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[A news / xml custom page for users ...]]></title>
			<link>https://punbb.informer.com/forums/post/49983/#p49983</link>
			<description><![CDATA[<p>Ohhhh warning : it&#039;s maybe a plugin ask but I think it&#039;s quite important ...</p><p>So ....</p><p><a href="http://www.sortons.net/dev/call_article2.php">http://www.sortons.net/dev/call_article2.php</a></p><p>Script </p><div class="quotebox"><blockquote><p>&lt;?php</p><p>/*<br />Created by Global Syndication&#039;s RSS Parser<br /><a href="http://www.globalsyndication.com/rss-parser">http://www.globalsyndication.com/rss-parser</a><br />*/</p><p>set_time_limit(0);</p><p>$file = &quot;<a href="http://www.lemonde.fr/rss/sequence/0,2-3224,1-0,0.xml">http://www.lemonde.fr/rss/sequence/0,2-3224,1-0,0.xml</a>&quot;;</p><p>$rss_channel = array();<br />$currently_writing = &quot;&quot;;<br />$main = &quot;&quot;;<br />$item_counter = 0;</p><p>function startElement($parser, $name, $attrs) {<br />&nbsp; &nbsp;&nbsp; &nbsp; global $rss_channel, $currently_writing, $main;<br />&nbsp; &nbsp;&nbsp; &nbsp; switch($name) {<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; case &quot;RSS&quot;:<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; case &quot;RDF:RDF&quot;:<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; case &quot;ITEMS&quot;:<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $currently_writing = &quot;&quot;;<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; case &quot;CHANNEL&quot;:<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $main = &quot;CHANNEL&quot;;<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; case &quot;IMAGE&quot;:<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $main = &quot;IMAGE&quot;;<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $rss_channel[&quot;IMAGE&quot;] = array();<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; case &quot;ITEM&quot;:<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $main = &quot;ITEMS&quot;;<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; default:<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $currently_writing = $name;<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />&nbsp; &nbsp;&nbsp; &nbsp; }<br />}</p><p>function endElement($parser, $name) {<br />&nbsp; &nbsp;&nbsp; &nbsp; global $rss_channel, $currently_writing, $item_counter;<br />&nbsp; &nbsp;&nbsp; &nbsp; $currently_writing = &quot;&quot;;<br />&nbsp; &nbsp;&nbsp; &nbsp; if ($name == &quot;ITEM&quot;) {<br />&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; $item_counter++;<br />&nbsp; &nbsp;&nbsp; &nbsp; }<br />}</p><p>function characterData($parser, $data) {<br />&nbsp; &nbsp; global $rss_channel, $currently_writing, $main, $item_counter;<br />&nbsp; &nbsp; if ($currently_writing != &quot;&quot;) {<br />&nbsp; &nbsp; &nbsp; &nbsp; switch($main) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case &quot;CHANNEL&quot;:<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (isset($rss_channel[$currently_writing])) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $rss_channel[$currently_writing] .= $data;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } else {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $rss_channel[$currently_writing] = $data;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case &quot;IMAGE&quot;:<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (isset($rss_channel[$main][$currently_writing])) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $rss_channel[$main][$currently_writing] .= $data;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } else {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $rss_channel[$main][$currently_writing] = $data;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case &quot;ITEMS&quot;:<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (isset($rss_channel[$main][$item_counter][$currently_writing])) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $rss_channel[$main][$item_counter][$currently_writing] .= $data;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } else {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $rss_channel[$main][$item_counter][$currently_writing] = $data;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />&nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; }<br />}</p><p>$xml_parser = xml_parser_create();<br />xml_set_element_handler($xml_parser, &quot;startElement&quot;, &quot;endElement&quot;);<br />xml_set_character_data_handler($xml_parser, &quot;characterData&quot;);<br />if (!($fp = fopen($file, &quot;r&quot;))) {<br />&nbsp; &nbsp; die(&quot;could not open XML input&quot;);<br />}</p><p>while ($data = fread($fp, 4096)) {<br />&nbsp; &nbsp; if (!xml_parse($xml_parser, $data, feof($fp))) {<br />&nbsp; &nbsp; &nbsp; &nbsp; die(sprintf(&quot;XML error: %s at line %d&quot;,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xml_error_string(xml_get_error_code($xml_parser)),<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; xml_get_current_line_number($xml_parser)));<br />&nbsp; &nbsp; }<br />}<br />xml_parser_free($xml_parser);</p><p>// output HTML<br /> print (&quot;&lt;div class=\&quot;channelname\&quot;&gt;&quot; . $rss_channel[&quot;TITLE&quot;] . &quot;&lt;/div&gt;&quot;); <br /> print (&quot;&lt;div class=\&quot;channeldescription\&quot;&gt;&quot; . $rss_channel[&quot;DESCRIPTION&quot;] . &quot;&lt;/div&gt;&lt;br /&gt;&quot;); <br />if (isset($rss_channel[&quot;ITEMS&quot;])) {<br />&nbsp; &nbsp; if (count($rss_channel[&quot;ITEMS&quot;]) &gt; 0) {<br />&nbsp; &nbsp; &nbsp; &nbsp; for($i = 0;$i &lt; count($rss_channel[&quot;ITEMS&quot;]);$i++) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (isset($rss_channel[&quot;ITEMS&quot;][$i][&quot;LINK&quot;])) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print (&quot;\n&lt;div class=\&quot;itemtitle\&quot;&gt;&lt;a href=\&quot;&quot; . $rss_channel[&quot;ITEMS&quot;][$i][&quot;LINK&quot;] . &quot;\&quot;&gt;&quot; . $rss_channel[&quot;ITEMS&quot;][$i][&quot;TITLE&quot;] . &quot;&lt;/a&gt;&lt;/div&gt;&quot;);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } else {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; print (&quot;\n&lt;div class=\&quot;itemtitle\&quot;&gt;&quot; . $rss_channel[&quot;ITEMS&quot;][$i][&quot;TITLE&quot;] . &quot;&lt;/div&gt;&quot;);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; print (&quot;&lt;div class=\&quot;itemdescription\&quot;&gt;&quot; . $rss_channel[&quot;ITEMS&quot;][$i][&quot;DESCRIPTION&quot;] . &quot;&lt;/div&gt;&lt;br /&gt;&quot;); &nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; } else {<br />&nbsp; &nbsp; &nbsp; &nbsp; print (&quot;&lt;b&gt;There are no articles in this feed.&lt;/b&gt;&quot;);<br />&nbsp; &nbsp; }<br />}</p><p>?&gt;</p></blockquote></div><p>I have had this idea by wanting put url as a data in url ... <a href="http://www.sortons.net/dev/call_article2.php?file=http://www.lemonde.fr/rss/sequence/0,2-3224,1-0,0.xml">http://www.sortons.net/dev/call_article … ,1-0,0.xml</a></p><p>At the beginning, I wanted to do a standalone version and I have had an idea ... would it be possible users SHARE THEIR OWN news feed RSS and a pun Plugin create a page with blocks containing custom news for each users ??? And we can imagine by &quot;default&quot; the page could regroup all news brought by all users ?!</p>]]></description>
			<author><![CDATA[null@example.com (Rod)]]></author>
			<pubDate>Tue, 23 Aug 2005 11:41:40 +0000</pubDate>
			<guid>https://punbb.informer.com/forums/post/49983/#p49983</guid>
		</item>
	</channel>
</rss>
