Stop data retention! Click here & act! Are you a webmaster and want to participate? Here you can find all necessary material for your website - Willst du auch an der Aktion teilnehmen? Hier findest du alle relevanten Infos und Materialien:
Chris Karakas Online Forum Index Karakas Online
 FAQFAQ   Forum SearchForum Search   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
RSS newsfeed of the PHP-Nuke Forum


Goto page 1, 2, 3 ... 9, 10, 11  Next
 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.
   Chris Karakas Online Forum Index -> PHP-Nuke Forum RSS Feed of this Forum
Share this page: These icons link to social bookmarking sites where readers can share and discover new web pages.Digg  del.icio.us  tc.eserver.org  Blinklist  Furl  Reddit  Blogmarks  Magnolia  Sphere  Yahoo!  Google  Windows Live  Technorati  Blue Dot  Simpy  Newsvine  Stumble Upon  co.mments.com  Blinkbits  BlogMemes  Connotea  View previous topic :: View next topic  
Author Message
chris
Dark Lord of the Sith


Joined: 10 May 2003
Posts: 6267
Location: Outer Space

PostPosted: Mon May 24, 2004 9:44 pm    Post subject: RSS newsfeed of the PHP-Nuke Forum
Reply with quote

Hello,

you can now syndicate the latest headlines from the PHP-Nuke Forum using the URL

http://www.karakas-online.de/forum/rdf.php?fid=1

You can pass various parameters on the URL to control some aspects of the resulting headlines:

  • fid: the forumID (1=PHP-Nuke Forum). Use fid[] if you want to pass more than one fid parameters on the URL!
  • count: number of headlines (forum postings). Default: 10
  • type: news or latest. When you use news, the first posting will control the sorting of the headlines. When you use latest, it is the latest posting in a thread that determines the date (and thus the position) of the thread in the feed. Default: latest.
  • chars: sets the number of characters to be used in the description part of the news items. When 0, no description is output. Default: 200.
  • titlepattern: with this parameter, you can format the title of each news item (i.e. each headline). The following placeholders are offered:

    • __TITLE__ for the title of an item
    • __FORUM__ for the forum name
    • __DATE__ for the date in the format d.m.Y H:i


Examples:



You can see how the feeds look like in the Karakas Online Section of my News-o-matic.

Arrow Note: If you want to offer RSS feeds of your phpBB Forums too, just download rdf.tar and untar it (with tar or winzip) in the base directory of your phpBB. A tip of the hat to http://www.phpbb.de/rss.php for this fantastic script!

Enjoy!
_________________
Regards

Chris Karakas
www.karakas-online.de


Last edited by chris on Tue May 25, 2004 8:03 pm; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Imago
Corporal
Corporal


Joined: 25 May 2004
Posts: 15

PostPosted: Tue May 25, 2004 8:29 am    Post subject:
Reply with quote

Quote:
Open quoteyou can now syndicate the latest headlines from the PHP-Nuke ForumClose quote

Hello, Chris!

So far we can syndicate only the last infos from our stadnalone phpBB Forums, not from our nukebb forums. Here is how your feeds look at NukeWire:
www.nukewire.com/nukefeed485.html

It would be a really great contribution to the Php-Nuke community if the rdf.php script gets ported to work with the Php-Nuke forums.

Thank you
Back to top
View user's profile Send private message Visit poster's website
chris
Dark Lord of the Sith


Joined: 10 May 2003
Posts: 6267
Location: Outer Space

PostPosted: Tue May 25, 2004 12:51 pm    Post subject:
Reply with quote

Yes, rdf.php is written for the standalone phpBB, which is used in my Forums. I just did not know of the existence of such a possibility for the standalone phpBB - until recently, that is. Wink

I thought this has already been done for phpNuke - I see blocks with the "latest Forums postings" in almost every PHP-Nuke site, see nukecops.com etc. And I see that nukecops has a "Forums" block in the upper right, with a small XML icon in it. Wink

The icon points to http://www.nukecops.com/backendforums.php , so you should ask nukecops if they can give you that backendforum.php file.

But just wait...a small search for "download backendforums.php" and ...here is a copy I found in the Net: Smile

Code:

 <?php

/************************************************************************/
/* RSS Feed for PHP-Nuke phpBB2 Forums                              */
/* ===================================                              */
/*                                                                      */
/* Copyright (c) 2003 by Paul Laudanski (Zhen-Xjell)              */
/* http://nukecops.com                                                  */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/* See a copy of the GPL licensed attached in the archive.      */
/************************************************************************/

include("mainfile.php");

header("Content-Type: text/xml");
$result = sql_query("SELECT t.topic_id, t.topic_title FROM ".$prefix."_bbtopics t, ".$prefix."_bbforums f where t.forum_id=f.forum_id and f.auth_view=0  ORDER BY t.topic_last_post_id DESC LIMIT 10", $dbi);

    if (!result) {
   echo "An error occured";
    } else {
        echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n\n";
   echo "<!DOCTYPE rss PUBLIC \"-//Netscape Communications//DTD RSS 0.91//EN\"\n";
   echo " \"http://my.netscape.com/publish/formats/rss-0.91.dtd\">\n\n";
        echo "<rss version=\"0.91\">\n\n";
   echo "<channel>\n";
        echo "<title>".htmlspecialchars($sitename)."- Forums</title>\n";
        echo "<link>$nukeurl</link>\n";
        echo "<description>".htmlspecialchars($backend_title)."</description>\n";
   echo "<language>$backend_language</language>\n\n";
        for ($m=0; $m < sql_num_rows($result, $dbi); $m++) {
       list($topic_id, $topic_title) = sql_fetch_row($result, $dbi);
            echo "<item>\n";
            echo "<title>".htmlspecialchars($topic_title)."</title>\n";
            echo "<link>$nukeurl/ftopic$topic_id.html</link>\n";
         echo "</item>\n\n";
        }
   echo "</channel>\n";
        echo "</rss>";
    }

?>


A tip of the hat to ZX of nukecops for this script!

Arrow As you see, I do not just give you the solution, I also show you how I arrived at it. I do this deliberately to help our readers find their own way to their solutions, not only my solutions. Wink
Confucius wrote:
Open quoteGive a man a fish and you feed him for a day. Teach a man to fish, and you feed him for a lifetime. Close quote

_________________
Regards

Chris Karakas
www.karakas-online.de
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Imago
Corporal
Corporal


Joined: 25 May 2004
Posts: 15

PostPosted: Tue May 25, 2004 1:14 pm    Post subject:
Reply with quote

Thank you,

I am using the NC backendforums.php for more than a year. Before that, I was using another RSS backend file, called forumsnews.php
Code:
<?php

include("mainfile.php");
global $prefix, $dbi, $sitename, $user, $cookie, $group_id;
    header("Content-Type: text/xml");
    echo "<?xml version=\"1.0\" encoding=\"Windows-1251\"?>\n\n";
    echo "<!DOCTYPE rss PUBLIC \"-//Netscape Communications//DTD RSS 0.91//EN\"\n";
    echo " \"http://my.netscape.com/publish/formats/rss-0.91.dtd\">\n\n";
    echo "<rss version=\"0.91\">\n\n";
    echo "<channel>\n";
    echo "<title>".htmlspecialchars($sitename)."</title>\n";
    echo "<link>$nukeurl</link>\n";
    echo "<description>".htmlspecialchars($backend_title)."</description>\n";
    echo "<language>$backend_language</language>\n\n";
    $count = 1;
    $result1 = sql_query("SELECT topic_id, topic_last_post_id, topic_title FROM ".$prefix."_bbtopics ORDER BY topic_last_post_id DESC LIMIT 10", $dbi);
    while(list($topic_id, $topic_last_post_id, $topic_title) = sql_fetch_row($result1, $dbi)) {
   $result2 = sql_query("SELECT topic_id, poster_id, FROM_UNIXTIME(post_time,'%b %d, %Y at %T') as post_time FROM ".$prefix."_bbposts where post_id='$topic_last_post_id'", $dbi);
   list($topic_id, $poster_id, $post_time)=sql_fetch_row($result2, $dbi);
        echo "<item>\n";
        echo "<title>".htmlspecialchars($topic_title)."</title>\n";
        echo "<link>$nukeurl/modules.php?name=Forums&file=viewtopic&p=$topic_last_post_id#$topic_last_post_id</link>\n";
        echo "</item>\n\n";
   }
    echo "</channel>\n";
    echo "</rss>";
?>

It is really strange that nukers are not aware of it or do not want to take full use of it.

The question at issue here is an RSS file to handle the news from the individual forums, the same as Paul has on each of his forums. People have asked him to share the files, but I am afraid, Paul didn't pay attention or didn't have time to do so.

The rdf.php is something radically different. Perhaps I should announce a second contest to port this file for the Php-Nuke users. Smile Unfortunately, we didn't collect much money for the first contest and it is not yet over, to announce a second one.
Back to top
View user's profile Send private message Visit poster's website
chris
Dark Lord of the Sith


Joined: 10 May 2003
Posts: 6267
Location: Outer Space

PostPosted: Tue May 25, 2004 1:59 pm    Post subject:
Reply with quote

Take your time. Mr. Green

And search the Net thoroughly - maybe such a script is already there somewhere. You could for example search the large repositories of Nuke code...

But please don't forget to tell us when you find it. Smile
_________________
Regards

Chris Karakas
www.karakas-online.de
Back to top
View user's profile Send private message Send e-mail Visit poster's website
chris
Dark Lord of the Sith


Joined: 10 May 2003
Posts: 6267
Location: Outer Space

PostPosted: Tue May 25, 2004 2:15 pm    Post subject:
Reply with quote

On second thought, it doesn't seem to be that difficult to pass an URL parameter fid to the script, then add the lines:

Code:

$php_ver = phpversion();
$php_ver = explode(".", $php_ver);
$phpver = "$php_ver[0]$php_ver[1]";
if ($phpver >= 41) {
    $fid = $_GET['fid'];
} else {
    $fid = $HTTP_GET_VARS['fid'];
}

fid = intval($fid);


at the start of the script and change the "$result = ..." line to:

Code:

if ($fid) {
$result = sql_query("SELECT t.topic_id, t.topic_title FROM ".$prefix."_bbtopics t, ".$prefix."_bbforums f where t.forum_id=f.forum_id and f.auth_view=0  and f.forum_id = ". $fid ."ORDER BY t.topic_last_post_id DESC LIMIT 10", $dbi);
} else {
$result = sql_query("SELECT t.topic_id, t.topic_title FROM ".$prefix."_bbtopics t, ".$prefix."_bbforums f where t.forum_id=f.forum_id and f.auth_view=0  ORDER BY t.topic_last_post_id DESC LIMIT 10", $dbi);
}


Do I win that unannounced contest now? Mr. Green
_________________
Regards

Chris Karakas
www.karakas-online.de
Back to top
View user's profile Send private message Send e-mail Visit poster's website
chris
Dark Lord of the Sith


Joined: 10 May 2003
Posts: 6267
Location: Outer Space

PostPosted: Tue May 25, 2004 5:49 pm    Post subject:
Reply with quote

O.K., here is the full adaptation of the rdf.php script to PHP-Nuke. For your convenience, you can download it also from

http://www.karakas-online.de/phpnuke/rdf-nuke.tar

Extract the tar archive in your PHP-Nuke root. Change the Forums module name in the script, should your Forums module be called something else and not "Forums" - and that's all!

Read the instructions in the script itself. You can pass it parameters in exactly the same way as I described above for the standalone phpBB package.

Please test it and report any bugs here.

Enjoy!

Code:

<?php

/************************************************************************/
/* RSS Feed for PHP-Nuke phpBB2 Forums                                  */
/* ===================================                                  */
/*                                                                      */
/*   copyright            : (C) 2002 Matthijs van de Water              */
/*                                   Sascha Carlin                      */
/*   email                : matthijs@beryllium.net                      */
/*                          sc@itst.org                                 */
/*                                                                      */
/* Copyright (c) 2003 by Paul Laudanski (Zhen-Xjell)                    */
/* http://nukecops.com                                                  */
/*                                                                      */
/* Copyright (c) 2004 by Chris Karakas                                  */
/* http://www.karakas-online.de                                         */
/*                                                                      */
/* Note from Chris: I have "glued" rdf.php of Mathias and Sacha from    */
/*                                                                      */
/* http://www.phpbb.de/rss.php                                          */
/*                                                                      */
/* and backendforums.php of Paul from                                   */
/*                                                                      */
/* http://www.nukecops.com                                              */
/*                                                                      */
/* to make an RSS scipt that works for PHP-Nuke, like                   */
/* backendforums.php, and has the rich features of rdf.php.             */
/* I have made notes in the code, indicating the relevant sources.      */
/*                                                                      */
/* See http://www.karakas-online.de/forum/viewtopic.php?t=899           */
/* for more details.                                                    */
/*                                                                      */
/* Enjoy!                                                               */
/*                                                                      */
/* Chris                                                                */
/*                                                                      */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/* See a copy of the GPL licensed attached in the archive.              */
/************************************************************************/


/***************************************************************************
*
*   Adapted from PHPBB 2.0 RDF CONTENT SYNDICATOR
*   Shows last active topics RDF XML form
*
***************************************************************************
*
*   Put this file in your PHP-Nuke root  directory.
*   You can call this script without parameters, what will
*   result in an RDF with the 10 latest posts from all your forums.
*   You can specify the number of posts via the url parameter count:
*
*   http://www.domain.com/php-nuke/rdf-nuke.php?count=50
*
*   This will result in an RDF file with the latest 50 posts from
*   all your forums.
*
*   You can also specify to look only at a specified forum using the
*   fid parameter:
*
*   http://www.domain.com/php-nuke/rdf-nuke.php?fid=9
*
*   This will result in an RDF file with the latest 10 posts from
*   your forum with the id 9.
*
*   You can also mix the paramters:
*
*   http://www.domain.com/php-Nuke/rdf-nuke.php?fid=5&count=3
*
*   will show you the latest 3 posts from forum 5.
*
*   THIS SCRIPT WILL ONLY SHOW POSTS FROM PUBLIC FORUMS
*
***************************************************************************/



// Inserted by Chris:
include("mainfile.php");

$module_name = "Forums";
$nuke_root_path = "modules.php?name=" . $module_name;
$nuke_file_path = $nuke_root_path . "&file=";
// require("modules/$module_name/nukebb.php");

define('IN_PHPBB', true);
$phpbb_root_path = './modules/' . $module_name . '/';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
// include("includes/functions_selects.php");


// Taken from rdf.php:

// XML and nocaching headers
header ('Cache-Control: private, pre-check=0, post-check=0, max-age=0');
header ('Expires: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT');
header ('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header ('Content-Type: text/xml');


// If not set, set the output count to 10
$count = ( !isset($HTTP_GET_VARS['count']) ) ? 10 : intval($HTTP_GET_VARS['count']);
$count = ( $count == 0 ) ? 10 : $count;

// Characters
$chars = ( isset($HTTP_GET_VARS['chars']) ) ? intval($HTTP_GET_VARS['chars']) : 200;
if($chars<0 || $chars>500) $chars=500; //Maximum
$type = ( isset($HTTP_GET_VARS['type']) ) ? $HTTP_GET_VARS['type'] : 'latest';
$news = ( $type == 'news' );
   
// Create main board url (some code borrowed from functions_post.php)
// viewtopic and index adapted by Chris
$viewtopic = $nuke_file_path . 'viewtopic';

// We don't need thse, but anyway...
$server_name = trim($board_config['server_name']);
$server_protocol = ( $board_config['cookie_secure'] ) ? 'https://' : 'http://';
$server_port = ( $board_config['server_port'] <> 80 ) ? ':' . trim($board_config['server_port']) . '/' : '/';

$viewtopic_url = dirname($nukeurl) . '/' . $viewtopic;

// For debugging purposes, you can see $viewtopic here:
// echo $viewtopic_url;

// Some code taken from backendforums.php in this rdf string:
$rdf = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>
<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns=\"http://my.netscape.com/rdf/simple/0.9/\">

<channel>
    <title>".htmlspecialchars($sitename)."- Forums</title>
    <link>$nukeurl</link>
    <description>".htmlspecialchars($backend_title)."</description>
    <language>$backend_language</language>
</channel>
";

// Taken from rdf.php:
$fid = ( isset($HTTP_GET_VARS['fid']) ) ? $HTTP_GET_VARS['fid'] : array();
if(!is_array($fid)) $fid = array($fid);

$fid_new = array();
for($i=0; $i<sizeof($fid); $i++)
{
    if(intval($fid[$i]) > 0)
    {
        if(!in_array($fid[$i], $fid_new))
        {
            $fid_new[] = $fid[$i];
        }
    }
}
$fid = $fid_new;
$sql_where = ( sizeof($fid)>0 ) ? " AND f.forum_id IN (" . implode($fid, ", ") . ")" : " ";

$sql_orderby = $news ? 't.topic_time DESC' : 'p.post_time DESC';
$sql_post_id_field = $news ? 't.topic_first_post_id' : 't.topic_last_post_id';

// Added by Chris:
define('TOPICS_TABLE', $prefix.'_bbtopics');
define('POSTS_TABLE', $prefix.'_bbposts');
define('POSTS_TEXT_TABLE', $prefix.'_bbposts_text');
define('FORUMS_TABLE', $prefix.'_bbforums');
define('AUTH_ALL', 0);
define('POST_TOPIC_URL', 't');
define('POST_POST_URL', 'p');

// Taken from rdf.php:
// SQL statement to fetch active topics of public forums
$sql = "SELECT t.topic_id, t.topic_title, p.post_id, p.post_time, pt.post_text, pt.bbcode_uid, f.forum_name FROM " . TOPICS_TABLE . " AS t, " . POSTS_TABLE . " AS p, " . POSTS_TEXT_TABLE . " AS pt, " . FORUMS_TABLE . " AS f WHERE f.forum_id = t.forum_id AND f.auth_view = " . AUTH_ALL . " AND p.topic_id = t.topic_id AND p.post_id = $sql_post_id_field AND pt.post_id = p.post_id $sql_where ORDER BY $sql_orderby LIMIT $count";

// For debugging purposes, you can echo the SQL statement here:
// echo $sql;

$topics_query = $db->sql_query($sql);
//die($sql);
if ( !$topics_query )
{
    die("Failed obtaining list of active topics");
}
else
{
    $topics = $db->sql_fetchrowset($topics_query);
}

if ( count($topics) == 0 )
{   
    die("No topics found");
}
else
{   
    // $topics contains all interesting data
    for ($i = 0; $i < count($topics); $i++)
    {
        if(isset($HTTP_GET_VARS['titlepattern']))
        {
            $title = $HTTP_GET_VARS['titlepattern'];
            $title = str_replace('__DATE__', date("d.m.Y H:i", $topics[$i]['post_time']), $title);
            $title = str_replace('__TITLE__', $topics[$i]['topic_title'], $title);
            $title = str_replace('__FORUM__', $topics[$i]['forum_name'], $title);
        }
        else
        {
            $title = $topics[$i]['topic_title'];
        }
        //$title = "[" . date("d.m.Y H:i", $topics[$i]['post_time']) . "|" . $topics[$i]['forum_name'] . "] " . $topics[$i]['topic_title'];
        // Changed the "?" to "&" in $url (Chris)
        $url = ($news) ? $viewtopic_url . "&" . POST_TOPIC_URL . "=" . $topics[$i]['topic_id'] : $viewtopic_url . "&" . POST_POST_URL . "=" . $topics[$i]['post_id'] . "#" . $topics[$i]['post_id'];
        $message = $topics[$i]['post_text'];
        $bbcode_uid = $topics[$i]['bbcode_uid'];
        $message = strip_tags($message);
        $message = preg_replace("/\[.*?:$bbcode_uid:?.*?\]/si", '', $message);
        $message = preg_replace('/\[url\]|\[\/url\]/si', '', $message);
        if($chars > 0) {
                $message = ( strlen($message) > $chars ) ? substr($message, 0, ($chars - 4)) . ' ...' : $message;
        }

        $rdf .= "
<item>
    <title>" . $title . "</title>
    <link>" . $url . "</link>";
//    <pubDate>" . date('r', $topics[$i]['post_time']) . "</pubDate>";

if($chars != 0 && strlen($message)>0) $rdf .= "
    <description>" . htmlspecialchars($message) . "</description>";

$rdf.="
</item>
"; 
    }
}

// Create RDF footer
$rdf .= "
</rdf:RDF>";

// Output the RDF
echo $rdf;

?>

_________________
Regards

Chris Karakas
www.karakas-online.de
Back to top
View user's profile Send private message Send e-mail Visit poster's website
chris
Dark Lord of the Sith


Joined: 10 May 2003
Posts: 6267
Location: Outer Space

PostPosted: Tue May 25, 2004 6:13 pm    Post subject:
Reply with quote

Just noticed the first bug in the above code! Mr. Green

You should replace the "&" in the URLs with its entity equivalent "& amp ;" (without the blanks).

The rdf-nuke.tar has already been corrected, so you should use this one, instead of the above code, which is only for illustration (and redundancy Wink ) purposes.
_________________
Regards

Chris Karakas
www.karakas-online.de
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Imago
Corporal
Corporal


Joined: 25 May 2004
Posts: 15

PostPosted: Tue May 25, 2004 6:37 pm    Post subject: The Nuke Syndication Revolution
Reply with quote

Chris, you are the undisputed a priori winner of the non-declared contest! Smile

The script works like a charm, this is the Googlifier Forum, one of our 35 forums at EuroNuke:

http://www.euronuke.org/nukefeed583.html

I am going to write a long praise for you and spread the good news over the globe. To say this is a revolution in the Nuke syndication is perhaps a very weak word. Smile

Mille mille Grazie!!!
Back to top
View user's profile Send private message Visit poster's website
chris
Dark Lord of the Sith


Joined: 10 May 2003
Posts: 6267
Location: Outer Space

PostPosted: Tue May 25, 2004 6:47 pm    Post subject:
Reply with quote

Thanks for the praise, this script was fun to write! Very Happy

Please test all parameters (I did not! Mr. Green ), before we announce it to the large village. Wink
_________________
Regards

Chris Karakas
www.karakas-online.de
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Share this page: These icons link to social bookmarking sites where readers can share and discover new web pages.Digg  del.icio.us  tc.eserver.org  Blinklist  Furl  Reddit  Blogmarks  Magnolia  Sphere  Yahoo!  Google  Windows Live  Technorati  Blue Dot  Simpy  Newsvine  Stumble Upon  co.mments.com  Blinkbits  BlogMemes  Connotea 
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.
   Chris Karakas Online Forum Index -> PHP-Nuke Forum
Page 1 of 11
This page contains valid HTML 4.01 Transitional - click here to check it!
This page contains a valid CSS - click here to check it!

 

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group