DigitalDark
02-20-2011, 07:15 PM
Hi! I'm triying to integrate in my portal the latest threads of vbulletin, I'm using this php code:
// ################################################## ####
// ## configuration
// ##
// ## $rss_file= ‘http://www.vbulletin.com/forum/external.php?type=rss’;
// ## Adjust this variable to point to your RSS feed
$rss_file = ‘http://forums.glassesadvisor.com/external.php?type=rss’;
// ## configuration end
// ################################################## ####
// ## Do not touch code below!
$is_item = false;
$tag = ”;
$title = ”;
$description = ”;
$link = ”;
function character_data($parser, $data)
{
global $is_item, $tag, $title, $description, $link;
if ($is_item)
{
switch ($tag)
{
case “TITLE”:
$title .= $data;
break;
case “DESCRIPTION”:
$description .= $data;
break;
case “LINK”:
$link .= $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, $rss_output;
if ($name == “ITEM”)
{
$rss_output .= “<dt><strong><a href=’” . trim($link) . “‘>” . htmlspecialchars(trim($title)) . “</a></strong></dt><dd>” . htmlspecialchars(trim($description)) . “</dd>”;
$title = “”;
$description = “”;
$link = “”;
$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($rss_file,”r”);
while ($data = fread($fp, 4096))
{
xml_parse($parser, $data, feof($fp));
}
fclose($fp);
xml_parser_free($parser);
It works, but I would like to stylice this part:
$rss_output .= “<dt><strong><a href=’” . trim($link) . “‘>” . htmlspecialchars(trim($title)) . “</a></strong></dt><dd>” . htmlspecialchars(trim($description)) . “</dd>”;
I'm triying to use this:
<div style= "style options...."></a href=’” . trim($link) . “>” . htmlspecialchars(trim($title)) . “</a></div>” . htmlspecialchars(trim($description)) .;
But I can't apply any div style or td style or similar... because php don't compile that... I would like to know how to show the rss_output in a custom area so I can format text... etc.
Thanks, any help would be appreciated.
--------------- Added 1298321719 at 1298321719 ---------------
Here is an example:
http://img829.imageshack.us/i/rssu.jpg/
// ################################################## ####
// ## configuration
// ##
// ## $rss_file= ‘http://www.vbulletin.com/forum/external.php?type=rss’;
// ## Adjust this variable to point to your RSS feed
$rss_file = ‘http://forums.glassesadvisor.com/external.php?type=rss’;
// ## configuration end
// ################################################## ####
// ## Do not touch code below!
$is_item = false;
$tag = ”;
$title = ”;
$description = ”;
$link = ”;
function character_data($parser, $data)
{
global $is_item, $tag, $title, $description, $link;
if ($is_item)
{
switch ($tag)
{
case “TITLE”:
$title .= $data;
break;
case “DESCRIPTION”:
$description .= $data;
break;
case “LINK”:
$link .= $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, $rss_output;
if ($name == “ITEM”)
{
$rss_output .= “<dt><strong><a href=’” . trim($link) . “‘>” . htmlspecialchars(trim($title)) . “</a></strong></dt><dd>” . htmlspecialchars(trim($description)) . “</dd>”;
$title = “”;
$description = “”;
$link = “”;
$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($rss_file,”r”);
while ($data = fread($fp, 4096))
{
xml_parse($parser, $data, feof($fp));
}
fclose($fp);
xml_parser_free($parser);
It works, but I would like to stylice this part:
$rss_output .= “<dt><strong><a href=’” . trim($link) . “‘>” . htmlspecialchars(trim($title)) . “</a></strong></dt><dd>” . htmlspecialchars(trim($description)) . “</dd>”;
I'm triying to use this:
<div style= "style options...."></a href=’” . trim($link) . “>” . htmlspecialchars(trim($title)) . “</a></div>” . htmlspecialchars(trim($description)) .;
But I can't apply any div style or td style or similar... because php don't compile that... I would like to know how to show the rss_output in a custom area so I can format text... etc.
Thanks, any help would be appreciated.
--------------- Added 1298321719 at 1298321719 ---------------
Here is an example:
http://img829.imageshack.us/i/rssu.jpg/