Hello I would like to get the XML feed for my site:
http://buildworx-mc.com/forum/syndication.php?fid=4&limit=5
And display them in this format:
<ul>
<li><a href="linktothread"> Topic 1 </a> </li>
<li><a href="linktothread"> Topic 2 </a> </li>
<li><a href="linktothread"> Topic 3 </a> </li>
</ul>
I guess the best/easiest method to do this is using PHP, so how can I get the XML and display them in list items? It'll be displayed on http://example.com while the feed is http://example.com/forum
I tried the other answers from other questions asked, but nothing seems to work for me.
You may need to use the command "file_get_contents" to get a copy of the remote file in order to parse it using PHP. I'm surprised this step is necessary since you say you want to display items from your forum on your site so you might be able to set the 'feed' variable to the direct link, assuming everything is under the same domain. If not, this ought to work.
$feed = file_get_contents('http://buildworx-mc.com/forum/syndication.php?fid=4&limit=5');
$xml = simplexml_load_string($feed);
$items = $xml->channel->item;
foreach($items as $item) {
$title = $item->title;
$link = $item->link;
$pubDate = $item->pubDate;
$description = $item->description;
echo $title . "<br>";
// continue to format as an unordered list
}