Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> How To's
Author Message
vector
Client



Joined: Nov 06, 2004
Posts: 20

PostPosted: Sun Nov 21, 2004 10:22 am Reply with quote

How did you get the forums feed in the center block on the main page. I have the rdf-nuke file but not quite sure how to set it up to monitor each forum topic. Could someone please point mein the right direction ? Ok a little more then a point. A step by step would be perfect.
 
View user's profile Send private message
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Sun Nov 21, 2004 5:21 pm Reply with quote

That a block I wrote. It's in the downloads http://www.ravenphpscripts.com/modules.php?name=Downloads&d_op=ns_getit&cid=7&lid=86&type=url#get
 
View user's profile Send private message
vector







PostPosted: Sun Nov 21, 2004 5:31 pm Reply with quote

I thought it was created by pulling with the rdf-nuke.php, I was hoping to get out of you how to get it to monitor and pull from my forums..
 
Raven







PostPosted: Sun Nov 21, 2004 6:58 pm Reply with quote

Are you talking about the XML feed or the Recent Forum Posts?
 
vector







PostPosted: Sun Nov 21, 2004 7:03 pm Reply with quote

the xml feed, i like the idea but its a lot over my head..Smile
 
Raven







PostPosted: Sun Nov 21, 2004 8:25 pm Reply with quote

Code:
<?php

require_once("config.php");
require_once("db/db.php");
$row = $db->sql_fetchrow($db->sql_query("SELECT * FROM ".$prefix."_config"));
$sitename = superhtmlentities($row[sitename]);
$nukeurl = $row[nukeurl];
$backend_title = superhtmlentities($row[backend_title]);
$backend_language = $row[backend_language];
function superhtmlentities($text) {
        // Thanks to mirrorball_girl for this
        $entities = array(128 => 'euro', 130 => 'sbquo', 131 => 'fnof', 132 => 'bdquo', 133 => 'hellip', 134 => 'dagger', 135 => 'Dagger', 136 => 'circ', 137 => 'permil', 138 => 'Scaron', 139 => 'lsaquo', 140 => 'OElig', 145 => 'lsquo', 146 => 'rsquo', 147 => 'ldquo', 148 => 'rdquo', 149 => 'bull', 150 => '#45', 151 => 'mdash', 152 => 'tilde', 153 => 'trade', 154 => 'scaron', 155 => 'rsaquo', 156 => 'oelig', 159 => 'Yuml');
        $new_text = '';
        for($i = 0; $i < strlen($text); $i++) {
            $num = ord($text {
                $i }
            );
            if (array_key_exists($num, $entities)) {
                switch ($num) {
                    case 150:
                    $new_text .= '-';
                    break;
                    case 153:
                    $new_text .= '(tm)';
                    break;
                    default:
                    $new_text .= "&".$entities[$num].';';
                }
            }
            else
                if ($num < 127 || $num > 159) {
                $new_text .= htmlentities($text {
                    $i }
                );
            }
        }
        $new_text = ereg_replace("  +", " ", $new_text);
        ## remove double spaces.
        return $new_text;
    }

header("Content-Type: application/rss+xml");
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";

$result = mysql_query("SELECT topic_id, forum_id, topic_last_post_id, topic_title FROM ".$prefix."_bbtopics ORDER BY topic_last_post_id DESC");

$amount  = 15;
$counter = 0;
while(list($topic_id, $forum_id, $topic_last_post_id, $topic_title) = mysql_fetch_row($result)) {
   $result1 = mysql_query( "SELECT auth_view, auth_read, forum_name, cat_id FROM ".$prefix."_bbforums where forum_id = '$forum_id'");
   list( $auth_view, $auth_read, $forum_name, $cat_id ) = mysql_fetch_row($result1);
   if( ( $auth_view != 0 ) or ( $auth_read != 0 ) ) continue;
   if( $topic_moved_id != 0 ) continue;
   ++$counter;
   $result3 = mysql_query("SELECT topic_id, FROM_UNIXTIME(post_time,'%b %d, %Y at %T') as post_time, username, user_id FROM ".$prefix."_bbposts," .$prefix."_users where post_id='$topic_last_post_id' AND user_id=poster_id Limit 1");
   list($topic_id, $post_time, $username, $user_id)=mysql_fetch_row($result3);
    $rtitle = superhtmlentities($topic_title);
    $rtitle = str_replace('_',' ',$rtitle); //added 9/1/2004
    echo "<item>\n";
    echo "<title>".htmlspecialchars($rtitle)."</title>\n";
    echo "<link>$nukeurl/postp$topic_last_post_id#$topic_last_post_id</link>\n";
    echo "</item>\n\n";
    if ($counter==$amount) break;
}
echo "</channel>\n";
echo "</rss>";

?>
 
vector







PostPosted: Mon Nov 22, 2004 4:39 am Reply with quote

OK, now im golden. Thank you for your help. Im going to get to work on where to edit this for each forum.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> How To's

View next topic
View previous topic
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
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©