Firefox PHP

RSS feeds on embeded phorum

Posted by martindhx 
RSS feeds on embeded phorum
October 10, 2006 08:51PM
Hello people,

I have runing an embeded phorum inside a custom site, and i want to use the phorum RSS feeds. The feeds are created without problems when the rss link is followed, but the xml file fails because of the sites non-xml content above the feeds.

[OT] And how can i make phorum to create a file for the feeds ?

Any help will be appretiated.

Thanks!
Re: RSS feeds on embeded phorum
October 11, 2006 03:40AM
Can you define embedded? Is that the portable code or are you using my embed_phorum module for the embedding? I am running RSS feeds with no problems, so my guess is that it's the portable code. Can you confirm this?


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: RSS feeds on embeded phorum
October 11, 2006 07:06AM
Hello Maurice,

Thanks for your reply, you all are doing an excellent job, im very happy with Phorum.

Im using your embed_phorum module and everything is OK but this problem with the feeds. I have the forum inside a div section, and what i obtain by following the RSS links is all my HTML code above the phorum div section, then the feeds, which are ok, and nothing following the closing rss tag.

Martin.
Re: RSS feeds on embeded phorum
October 11, 2006 07:56AM
Then you're not handling the embedding correctly. If you always output some page data before running the Phorum code, then that data will always be at the start of any ouput page, so the RSS and file downloads as well. I see two ways of fixing this:

1: move the include of run_phorum.php to the right spot

The only correct way to embed Phorum correctly is to include the run_phorum.php script before outputting any data. The run_phorum.php script will check if the rss or file page is loaded and if this is the case, dump their output and exit.

Please take a look at the example script embed_phorum/connectors/gitaar.net/example_page_script.php for a working example page script. There you can see that I include the run script before outputting the HTML for my page.

2: use output buffering to hold back your page header output

If it's not possible for you to turn around the coding a bit to make this work, then maybe you could add an ob_start() command at the very start of your page script (to start buffering any output from that point on) and modify the embed_phorum/run_phorum.php script to flush all buffered output before dumping rss or file data (new code is in green):
around line 81:

    // Pages for which direct and raw output is needed.
    if ($phorum_embed_page == "rss" || ($phorum_embed_page == "file" && $send_file)) {
       
        // Flush any buffered data, since that would break the output.
        while (ob_get_level() > 0) ob_end_clean();

        print $content;
        exit;
    }
I will add this extra code to the embed_phorum module package too, so upcoming versions will automatically have this in themm since simply adding an ob_start() call to the start of the page might be the easiest solution to work with for a lot of people.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: RSS feeds on embeded phorum
October 11, 2006 08:12AM
Maurice:

Just moved the run_phorum.php include at before outputting data and worked.

Thank you very much, keep doing it that well!

Martin.
Sorry, only registered users may post in this forum.

Click here to login