Chris04S
12-28-2008, 05:56 AM
Ok.. I followed the instructions here http://www.vbulletin.com/forum/showthread.php?t=159044 and it says to put the code below in the page
I dont have the <?php code on my page, I renamed my page index.php (it had been index.html) and there is not that code so I tried putting it in the body of the page in the head of the page, none of them worked, should I be calling this from a .css file or something somehow? Any tips?
It says to put this code Near the top of your php page, but after the <?php code include the following:
// ################################################## ####
// ## configuration
// ##
// ## $rss2_file= 'http://www.vbulletin.com/forum/external.php?type=rss2';
// ## Adjust this variable to point to your RSS2 feed
$rss2_file = 'http://www.vbulletin.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);
I dont have the <?php code on my page, I renamed my page index.php (it had been index.html) and there is not that code so I tried putting it in the body of the page in the head of the page, none of them worked, should I be calling this from a .css file or something somehow? Any tips?
It says to put this code Near the top of your php page, but after the <?php code include the following:
// ################################################## ####
// ## configuration
// ##
// ## $rss2_file= 'http://www.vbulletin.com/forum/external.php?type=rss2';
// ## Adjust this variable to point to your RSS2 feed
$rss2_file = 'http://www.vbulletin.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);