Announcement

Collapse
No announcement yet.

I can't include the latests posts into any page!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • I can't include the latests posts into any page!

    Before I went and did the "harder" part I simply included the required code for a RSS feed to be printed at my page, as in the last 10 posts made to my forum.

    I did so at this page: http://snesorama.us/new_posts.php

    Code:
     <?php
    
    // ######################################################
    // ## configuration
    // ##
    // ## $rss_file= 'http://www.vbulletin.com/forum/external.php?type=rss';
    // ## Adjust this variable to point to your RSS feed
     
    $rss_file = 'http://snesorama.us/board/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);
    
    echo $rss_output;
    
    ?>
    However, as you can see, the page is completely empty, thus something is wrong, and it aint the path, as it doesn't give any 404 error either.

    I sent this to technical staff aswell, but I just got a "I'm sorry, there's nothing more I can do for you".

    Like I said, I made it the simple way, just to test it. I just pasted the needed code into a blank .php file, added the <? php> around the code, and added the echo statement at the bottom of it.

    What am I doing wrong?

    Edit: I just noticed this may have been posted at the wrong subforum, please move if needed.

    Regards
    //matrlx
    Last edited by matrlx; Sat 31 Dec '05, 6:23pm.

  • #2
    This is a custom coding issue. Moved to PHP coding forum.
    Steve Machol, former vBulletin Customer Support Manager (and NOT retired!)
    Change CKEditor Colors to Match Style (for 4.1.4 and above)

    Steve Machol Photography


    Mankind is the only creature smart enough to know its own history, and dumb enough to ignore it.


    Comment

    widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
    Working...
    X