facebook transparent twitter
Go Back  

SawFirst Forum

> SawFirst - About Your Virtual Presence > Websites

Websites Let us know about your website or any other website you find helpful, here.

Reply
 
Thread Tools
  #1  
Old 01-13-2020, 06:21 PM
Pretty Girl's Avatar
Pretty Girl Pretty Girl is offline
I CAN POST MORE !!!
 
Join Date: Jul 2019
Location: Manila
Posts: 217
Default Show vbulletin latest threads on wordpress or any external page via RSS feed

This explains what needs to be done to include the 10 latest threads from your forums on an external PHP page using the RSS2 feed.

---------------------------------Near the top of your php page, but after the <?php code include the following:
Code:
// ###################################################### // ## configuration  // ##  // ## $rss2_file= 'http://www.sawfirst.com/forum/external.php?type=rss2';  // ## Adjust this variable to point to your RSS2 feed     $rss2_file = 'http://www.sawfirst.com/forum/external.php?type=rss2';        // ## configuration end  // ######################################################  // ## Do not touch code below!              $is_item = false;  $tag = '';  $title = '';  $description = '';  $link = '';  $date = '';  $author = '';        function character_data($parser, $data)  {      global $is_item, $tag, $title, $description, $link, $date, $author;      if ($is_item)      {          switch ($tag)          {              case "TITLE":              $title .= $data;              break;                    case "DESCRIPTION":              $description .= $data;              break;                    case "LINK":              $link .= $data;              break;                    case "PUBDATE":              $date .= $data;              break;                    case "AUTHOR":              $author .= $data;              break;          }      }  }        function begin_element($parser, $name)  {      global $is_item, $tag;      if ($is_item)      {          $tag = $name;      }      else if ($name == "ITEM")      {          $is_item = true;      }  }        function end_element($parser, $name)  {      global $is_item, $title, $description, $link, $date, $author, $rss2_output;      if ($name == "ITEM")      {          $rss2_output .= "<dt><strong><a href='" . trim($link) . "'>" . htmlspecialchars(trim($title)) . "</a></strong> - " . htmlspecialchars(trim($date)) . " by <em>" . htmlspecialchars(trim($author)) . "</em></dt><dd>" . htmlspecialchars(trim($description)) . "</dd>";          $title = "";          $description = "";          $link = "";          $date = "";          $author = "";          $is_item = false;      }  }              $parser = xml_parser_create();        xml_set_element_handler($parser, "begin_element", "end_element");  xml_set_character_data_handler($parser, "character_data");  $fp = fopen($rss2_file,"r");        while ($data = fread($fp, 4096))  {      xml_parse($parser, $data, feof($fp));          }        fclose($fp);  xml_parser_free($parser);

  1. Make sure to adjust the $xml_file variable at the very top of the code you just added.
  2. Add the following code to wherever on that page you want to display the output:
    Code:
    echo $rss2_output;
Attached Images
 
Reply With Quote
Reply

Tags
external, feed, latest, page, rss, show, threads, vbulletin, wordpress
Thread Tools



CONTACT US
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.