开发者

Getting myBB threads from a specific forum and display them on another page?

开发者 https://www.devze.com 2023-04-02 21:48 出处:网络
Hello I am trying to display up to 5 threads on my homepage 开发者_开发技巧from a specific forum. So I want to get the threads from \'Announcments\' located in http://example.com/forum and display the

Hello I am trying to display up to 5 threads on my homepage 开发者_开发技巧from a specific forum. So I want to get the threads from 'Announcments' located in http://example.com/forum and display them on the homepage in a list.

How can I do this using PHP?


Follow these steps to get an RSS feed from MyBB: http://wiki.mybb.com/index.php/RSS_Syndication. Looks like you can set the limit to 5 threads and select a forum to syndicate.

Then it's a matter of parsing your RSS feed using PHP. Half-baked code to get you started:

$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 and format variables

  }
0

精彩评论

暂无评论...
验证码 换一张
取 消