Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
Register FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 02-20-2011, 07:15 PM
DigitalDark DigitalDark is offline
 
Join Date: Dec 2009
Posts: 78
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Latest threads on an external page

Hi! I'm triying to integrate in my portal the latest threads of vbulletin, I'm using this php code:

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 .= &#8220;<dt><strong><a href=’” . trim($link) . “‘>” . htmlspecialchars(trim($title)) . “</a></strong></dt><dd>” . htmlspecialchars(trim($description)) . “</dd>”;
        $title = &#8220;”;
        $description = &#8220;”;
        $link = &#8220;”;
        $is_item = false;
    }
}
   
   
$parser = xml_parser_create();
   
xml_set_element_handler($parser, &#8220;begin_element”, “end_element”);
xml_set_character_data_handler($parser, &#8220;character_data”);
$fp = fopen($rss_file,&#8221;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:

PHP Code:
$rss_output .= &#8220;<dt><strong><a href=’” . trim($link) . “‘>” . htmlspecialchars(trim($title)) . “</a></strong></dt><dd>” . htmlspecialchars(trim($description)) . “</dd>”; 
I'm triying to use this:

PHP Code:
<div style= "style options...."></a href=&#8217;” . 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 [DATE]1298321719[/DATE] at [TIME]1298321719[/TIME] ---------------

Here is an example:

http://img829.imageshack.us/i/rssu.jpg/
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:36 AM.


Powered by vBulletin® Version 3.9.0
Copyright ©2000 - 2017, vBulletin Solutions Inc.