Pepsi
New Member
![New Member New Member](modules/Forums/images/ranks/1star.gif)
![](modules/Forums/images/avatars/gallery/blank.gif)
Joined: Jan 17, 2006
Posts: 3
|
Posted:
Tue Jan 17, 2006 9:37 pm |
|
Hi.. I've Been Looking Here And There To Find A Nice Looking Block That Can Show Only A Specific Category..
I'm Using This
Code:<?php
/************************************************************************************/
/* */
/* CENTER BLOCK: block-phpBB_Forums.php */
/* For PHP-Nuke 6.5 */
/* v1.5 06-04-2003 */
/* */
/* by: Maty Scripts (webmaster@matyscripts.com) */
/* http://www.matyscripts.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. */
/* */
/************************************************************************************/
if( eregi( "block-phpBB_Forums.php", $_SERVER['PHP_SELF'])) {
Header("Location: index.php");
die();
}
global $prefix, $user_prefix, $db, $sitename, $bgcolor1, $bgcolor2;
/**********************************/
/* */
/* Configuration parameters */
/* */
/**********************************/
// When set to 1 then Forums permissions which View and/or Read are NOT set to 'ALL' will NOT be displayed in the center block
$HideViewReadOnly = 1;
// Show only 5 last new topics
$Last_New_Topics = 10;
// Icon that is displayed in Center Block in front of Topic
$IconPath = "modules/Forums/templates/subSilver/images/icon_mini_message.gif";
/**********************************/
/* */
/* Don't Edit Below ! */
/* */
/**********************************/
$border = 1;
$cellspacing = 0;
$cellstyle = "style=\"border-left-width: 1; border-right-width: 1; border-top-width: 1; border-bottom-style: dotted; border-bottom-width: 1\"";
/* Total Amount of Topics */
$result = $db->sql_query( "SELECT * FROM ".$prefix."_bbtopics" );
$Amount_Of_Topics = $db->sql_numrows( $result );
/* Total Amount of Posts */
$result = $db->sql_query( "SELECT * FROM ".$prefix."_bbposts" );
$Amount_Of_Posts = $db->sql_numrows( $result );
/* Total Amount of Topic Views */
$Amount_Of_Topic_Views = 0;
$result = $db->sql_query( "SELECT topic_views FROM ".$prefix."_bbtopics" );
while( list( $topic_views ) = $db->sql_fetchrow( $result ) )
{
$Amount_Of_Topic_Views = $Amount_Of_Topic_Views + $topic_views;
}
/* Total Amount of Topic Replies */
$Amount_Of_Topic_Replies = 0;
$result = $db->sql_query( "SELECT topic_replies FROM ".$prefix."_bbtopics" );
while( list( $topic_replies ) = $db->sql_fetchrow( $result ) )
{
$Amount_Of_Topic_Replies = $Amount_Of_Topic_Replies + $topic_replies;
}
/* Total Amount of Members */
$result = $db->sql_query( "SELECT * FROM ".$user_prefix."_users" );
$Amount_Of_Members = $db->sql_numrows( $result ) - 1;
/* Last X New Topics */
$Count_Topics = 0;
$Topic_Buffer = "";
$result1 = $db->sql_query( "SELECT topic_id, forum_id, topic_last_post_id, topic_title, topic_poster, topic_views, topic_replies, topic_moved_id FROM ".$prefix."_bbtopics ORDER BY topic_last_post_id DESC" );
while( list( $topic_id, $forum_id, $topic_last_post_id, $topic_title, $topic_poster, $topic_views, $topic_replies, $topic_moved_id ) = sql_fetch_row( $result1, $dbi ) )
{
$skip_display = 0;
if( $HideViewReadOnly == 1 )
{
$result5 = $db->sql_query( "SELECT auth_view, auth_read FROM ".$prefix."_bbforums where forum_id = '$forum_id'" );
list( $auth_view, $auth_read ) = $db->sql_fetchrow( $result5 );
if( ( $auth_view != 0 ) or ( $auth_read != 0 ) ) { $skip_display = 1; }
}
if( $topic_moved_id != 0 )
{
// Shadow Topic !!
$skip_display = 1;
}
if( $skip_display == 0 )
{
$Count_Topics += 1;
$result2 = $db->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'" );
list( $topic_id, $poster_id, $post_time ) = $db->sql_fetchrow( $result2 );
$result3 = $db->sql_query( "SELECT username, user_id FROM ".$user_prefix."_users where user_id='$poster_id'" );
list( $uname, $uid ) = $db->sql_fetchrow( $result3 );
$LastPoster = "<A HREF=\"profile-.html$uid\"STYLE=\"text-decoration: none\"> $uname </a>";
$result4 = $db->sql_query( "SELECT username, user_id FROM ".$user_prefix."_users where user_id='$topic_poster'" );
list( $uname, $uid ) = $db->sql_fetchrow( $result4 );
$OrigPoster = "<A HREF=\"profile-.html$uid\"STYLE=\"text-decoration: none\"> $uname </a>";
$TopicImage = "<img src=\"$IconPath\" border=\"0\" alt=\"\">";
$TopicTitleShow = "<a href=\"forums.html?amp;file=viewtopic&p=$topic_last_post_id#$topic_last_post_id\"STYLE=\"text-decoration: none\">$topic_title</a>";
$Topic_Buffer .= "<tr height=20 onmouseover=\"this.style.backgroundColor='#C9CDD3'\" onmouseout=\"this.style.backgroundColor=''\"><td $cellstyle>$TopicImage </td><td $cellstyle>$TopicTitleShow</td><td $cellstyle><div align=\"center\">$OrigPoster</div></td><td $cellstyle><div align=\"center\"><b>$topic_views</b></div></td><td $cellstyle><div align=\"center\"><b>$topic_replies</b></div></td><td $cellstyle align=\"center\">$LastPoster<br><font size=\"-2\"><i>$post_time</i></font></td></tr>";
}
if( $Last_New_Topics == $Count_Topics ) { break 1; }
}
/* Write Table to Screen */
$content = "<table width=\"100%\" border=\"$border\" cellspacing=\"$cellspacing\" bordercolor=\"$bgcolor2\" bgcolor=\"#C9CDD3\">";
$content .= "<tr><td height=\"21\" align=\"center\" colspan=\"6\" bgcolor=\"#C9CDD3\"><b>$sitename</b></td></tr>";
$content .= "<tr><td> </td><td align=\"center\">"._BBFORUM_NEWTOPICS."</td><td align=\"center\">"._BBFORUM_POSTER."</td><td align=\"center\">"._BBFORUM_VIEWS."</td><td align=\"center\">"._BBFORUM_REPLIES."</td><td align=\"center\">"._BBFORUM_LASTPOSTER."</td></tr>";
$content .= "$Topic_Buffer";
$content .= "<tr><td align=\"center\" colspan=\"6\">"._BBFORUM_TOTTOPICS."<b>$Amount_Of_Topics</b> <b /b> "._BBFORUM_TOTPOSTS."<b>$Amount_Of_Posts</b> <b /b> "._BBFORUM_TOTVIEWS."<b>$Amount_Of_Topic_Views</b> <b /b> "._BBFORUM_TOTREPLIES."<b>$Amount_Of_Topic_Replies</b> <b /b> <a href=\"members.html\">"._BBFORUM_TOTMEMBERS."</a> <b>$Amount_Of_Members</b></center></td></tr>";
$content .= "<tr><td align=\"center\" colspan=\"6\">[ <a href=\"forums.html\">"._BBFORUM_FORUM."</a> ] [ <a href=\"modules.php?op=modload&name=Forums&file=search\">"._BBFORUM_SEARCH."</a> ]</center></td></tr>";
$content .= "</table>";
?>
|
I Know That I Have To Edit 1 To 0 In
Code:$HideViewReadOnly = 1;
|
Coz This Specific Category Are Meant For Private Group Only
But How Do I Actually Make The Block Only Show Topics From A Specific Category ? For Example Category 17
Thanks .. I've Searched And Tried A Few Like
Code:WHERE forum_id IN(1,3,23)
|
And A Few Others.. But They Return An Errors Saying Some Syxtax Thinggy..
Thanks Again.. |
|
|
Pepsi
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Tue Jan 17, 2006 10:57 pm |
|
Ahh I Dont Have It Anymore.. Coz I Deleted It When It Caused Errors.
The Problem Is.. I Have Another Forum Center Block That Works..
This Is The One
Code:<?php
########################################################################
# PHP-Nuke Block: Helius Center Forum Block v.9 #
# Made for PHP-Nuke 6.* and the phpbb2 Nuke port 2.06 only #
# #
# Made by coldblooded http://www.nukemods.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. #
# If you modify this, let me know for fun. =) #
########################################################################
## Modified by Gaylen Fraley (aka Raven) 8/13/2005 to allow blocking ##
## certain categories. Also changed $dbi calls to $db ##
########################################################################
if (eregi("block-PH2BLUE_CB-Forums.php",$PHP_SELF)) {
Header("Location: index.php");
die();
}
global $user_prefix, $db, $theme, $sitename, $admin, $bgcolor1, $bgcolor2, $bgcolor4;
$HideViewReadOnly = 0;
$Last_New_Topics = 5;
$ThemeSel = get_theme();
$show = " <tr>
<td bgcolor=\"#C9CDD3\" bordercolor=\"#000000\" border=\"2\" cellspacing=\"1\" height=\"25\" colspan=\"6\" align=\"center\"></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>";
$Count_Topics = 0;
$Topic_Buffer = "70,71";
$catIdsToSkip = '14,11,10,9,7,13,5,16,3,15,2,1';
$sql = "SELECT t.topic_id, f.forum_id, t.topic_last_post_id, t.topic_title, t.topic_poster, t.topic_views, t.topic_replies, t.topic_moved_id FROM ".$user_prefix."_bbtopics t, ".$user_prefix."_bbforums f where f.cat_id NOT IN($catIdsToSkip) AND t.forum_id=f.forum_id ORDER BY topic_last_post_id DESC";
$result = $db->sql_query($sql);
while( list( $topic_id, $forum_id, $topic_last_post_id, $topic_title, $topic_poster, $topic_views, $topic_replies, $topic_moved_id ) = $db->sql_fetchrow( $result) )
{
$skip_display = 0;
if( $HideViewReadOnly == 1 )
{
$result2 = $db->sql_query( "SELECT auth_view, auth_read FROM ".$user_prefix."_bbforums where forum_id = '$forum_id'");
list( $auth_view, $auth_read ) = $db->sql_fetchrow( $result2 );
if( ( $auth_view != 0 ) or ( $auth_read != 0 ) ) { $skip_display = 1; }
}
if( $topic_moved_id != 0 )
{
// Shadow Topic !!
$skip_display = 1;
}
if( $skip_display == 0 )
{
$Count_Topics += 1;
$result2 = $db->sql_query("SELECT username, user_id FROM ".$user_prefix."_users where user_id='$topic_poster'");
list($username, $user_id)=$db->sql_fetchrow($result2);
$avtor=$username;
$sifra=$user_id;
$result3 = $db->sql_query("SELECT poster_id, FROM_UNIXTIME(post_time,'%m/%d/%Y at %H:%i') as post_time FROM ".$user_prefix."_bbposts where post_id='$topic_last_post_id'");
list($poster_id, $post_time)=$db->sql_fetchrow($result3);
$result4 = $db->sql_query("SELECT username, user_id FROM ".$user_prefix."_users where user_id='$poster_id'");
list($username, $user_id)=$db->sql_fetchrow($result4);
$viewlast .=" <tr>
<td height=\"15\" nowrap bgcolor=\"#C9CDD3\" bordercolor=\"$bgcolor2\" class=\"row1\"><img src=\"/modules/Forums/templates/subSilver/images/icon_mini_message.gif\" border=\"0\" /></td>
<td width=\"100%\" bgcolor=\"#C9CDD3\" bordercolor=\"$bgcolor2\" class=\"row1\"> <a href=\"forums.html?file=viewtopic&t=$topic_id#$topic_last_post_id\">$topic_title</a></td>
<td align=\"center\" bgcolor=\"#C9CDD3\" bordercolor=\"$bgcolor2\" class=\"row3\"><a href=\"profile-.html$user_id\">$avtor</a></td>
<td align=\"center\" bgcolor=\"#C9CDD3\" bordercolor=\"$bgcolor2\" class=\"row2\">$topic_views</td>
<td align=\"center\" bgcolor=\"#C9CDD3\" bordercolor=\"$bgcolor2\" class=\"row2\">$topic_replies</td>
<td align=\"center\" nowrap bgcolor=\"#C9CDD3\" bordercolor=\"$bgcolor2\" class=\"row3\"><font size=\"-2\"><i> $post_time </i></font><br>
<a href=\"profile-.html$user_id\">$username</a> <a href=\"forums.html?file=viewtopic&p=$topic_last_post_id#$topic_last_post_id\"><img src=\"themes/$ThemeSel/forums/images/icon_minipost_new.gif\" border=\"0\" alt=\"Latest Post\"></a></td>
</tr>";
}
if( $Last_New_Topics == $Count_Topics ) { break 1; }
}
$content .= "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
<tr>
<td bgcolor=\"#C9CDD3\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
<tr>
<td><table width=\"100%\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\">
<tr>
<th height=\"25\" colspan=\"2\" align=\"center\" class=\"thcornerl\"><font color=\"#000000\"></font>New Topics</th>
<th width=\"100\" align=\"center\" class=\"thtop\"><font color=\"#000000\"></font> Poster </th>
<th width=\"25\" align=\"center\" class=\"thtop\"><font color=\"#000000\"></font> Views </th>
<th width=\"25\" align=\"center\" class=\"thtop\"><font color=\"#000000\"></font> Replies </th>
<th align=\"center\" nowrap background=\"themes/$ThemeSel/forums/images/top_center.gif\" class=\"thcornerr\"><font color=\"#000000\"></font> Last Poster </th>
</tr>";
$content .= "$viewlast";
$content .= "$show";
?>
|
The Block Above Does Work...
But I Wanna Use This Block Instead
Code:<?php
/************************************************************************************/
/* */
/* CENTER BLOCK: block-phpBB_Forums.php */
/* For PHP-Nuke 6.5 */
/* v1.5 06-04-2003 */
/* */
/* by: Maty Scripts (webmaster@matyscripts.com) */
/* http://www.matyscripts.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. */
/* */
/************************************************************************************/
if( eregi( "block-phpBB_Forums.php", $_SERVER['PHP_SELF'])) {
Header("Location: index.php");
die();
}
global $prefix, $user_prefix, $db, $sitename, $bgcolor1, $bgcolor2;
/**********************************/
/* */
/* Configuration parameters */
/* */
/**********************************/
// When set to 1 then Forums permissions which View and/or Read are NOT set to 'ALL' will NOT be displayed in the center block
$HideViewReadOnly = 1;
// Show only 5 last new topics
$Last_New_Topics = 10;
// Icon that is displayed in Center Block in front of Topic
$IconPath = "modules/Forums/templates/subSilver/images/icon_mini_message.gif";
/**********************************/
/* */
/* Don't Edit Below ! */
/* */
/**********************************/
$border = 1;
$cellspacing = 0;
$cellstyle = "style=\"border-left-width: 1; border-right-width: 1; border-top-width: 1; border-bottom-style: dotted; border-bottom-width: 1\"";
/* Total Amount of Topics */
$result = $db->sql_query( "SELECT * FROM ".$prefix."_bbtopics" );
$Amount_Of_Topics = $db->sql_numrows( $result );
/* Total Amount of Posts */
$result = $db->sql_query( "SELECT * FROM ".$prefix."_bbposts" );
$Amount_Of_Posts = $db->sql_numrows( $result );
/* Total Amount of Topic Views */
$Amount_Of_Topic_Views = 0;
$result = $db->sql_query( "SELECT topic_views FROM ".$prefix."_bbtopics" );
while( list( $topic_views ) = $db->sql_fetchrow( $result ) )
{
$Amount_Of_Topic_Views = $Amount_Of_Topic_Views + $topic_views;
}
/* Total Amount of Topic Replies */
$Amount_Of_Topic_Replies = 0;
$result = $db->sql_query( "SELECT topic_replies FROM ".$prefix."_bbtopics" );
while( list( $topic_replies ) = $db->sql_fetchrow( $result ) )
{
$Amount_Of_Topic_Replies = $Amount_Of_Topic_Replies + $topic_replies;
}
/* Total Amount of Members */
$result = $db->sql_query( "SELECT * FROM ".$user_prefix."_users" );
$Amount_Of_Members = $db->sql_numrows( $result ) - 1;
/* Last X New Topics */
$Count_Topics = 0;
$Topic_Buffer = "";
$result1 = $db->sql_query( "SELECT topic_id, forum_id, topic_last_post_id, topic_title, topic_poster, topic_views, topic_replies, topic_moved_id FROM ".$prefix."_bbtopics ORDER BY topic_last_post_id DESC" );
while( list( $topic_id, $forum_id, $topic_last_post_id, $topic_title, $topic_poster, $topic_views, $topic_replies, $topic_moved_id ) = sql_fetch_row( $result1, $dbi ) )
{
$skip_display = 0;
if( $HideViewReadOnly == 1 )
{
$result5 = $db->sql_query( "SELECT auth_view, auth_read FROM ".$prefix."_bbforums where forum_id = '$forum_id'" );
list( $auth_view, $auth_read ) = $db->sql_fetchrow( $result5 );
if( ( $auth_view != 0 ) or ( $auth_read != 0 ) ) { $skip_display = 1; }
}
if( $topic_moved_id != 0 )
{
// Shadow Topic !!
$skip_display = 1;
}
if( $skip_display == 0 )
{
$Count_Topics += 1;
$result2 = $db->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'" );
list( $topic_id, $poster_id, $post_time ) = $db->sql_fetchrow( $result2 );
$result3 = $db->sql_query( "SELECT username, user_id FROM ".$user_prefix."_users where user_id='$poster_id'" );
list( $uname, $uid ) = $db->sql_fetchrow( $result3 );
$LastPoster = "<A HREF=\"profile-.html$uid\"STYLE=\"text-decoration: none\"> $uname </a>";
$result4 = $db->sql_query( "SELECT username, user_id FROM ".$user_prefix."_users where user_id='$topic_poster'" );
list( $uname, $uid ) = $db->sql_fetchrow( $result4 );
$OrigPoster = "<A HREF=\"profile-.html$uid\"STYLE=\"text-decoration: none\"> $uname </a>";
$TopicImage = "<img src=\"$IconPath\" border=\"0\" alt=\"\">";
$TopicTitleShow = "<a href=\"forums.html?amp;file=viewtopic&p=$topic_last_post_id#$topic_last_post_id\"STYLE=\"text-decoration: none\">$topic_title</a>";
$Topic_Buffer .= "<tr height=20 onmouseover=\"this.style.backgroundColor='#C9CDD3'\" onmouseout=\"this.style.backgroundColor=''\"><td $cellstyle>$TopicImage </td><td $cellstyle>$TopicTitleShow</td><td $cellstyle><div align=\"center\">$OrigPoster</div></td><td $cellstyle><div align=\"center\"><b>$topic_views</b></div></td><td $cellstyle><div align=\"center\"><b>$topic_replies</b></div></td><td $cellstyle align=\"center\">$LastPoster<br><font size=\"-2\"><i>$post_time</i></font></td></tr>";
}
if( $Last_New_Topics == $Count_Topics ) { break 1; }
}
/* Write Table to Screen */
$content = "<table width=\"100%\" border=\"$border\" cellspacing=\"$cellspacing\" bordercolor=\"$bgcolor2\" bgcolor=\"#C9CDD3\">";
$content .= "<tr><td height=\"21\" align=\"center\" colspan=\"6\" bgcolor=\"#C9CDD3\"><b>$sitename</b></td></tr>";
$content .= "<tr><td> </td><td align=\"center\">"._BBFORUM_NEWTOPICS."</td><td align=\"center\">"._BBFORUM_POSTER."</td><td align=\"center\">"._BBFORUM_VIEWS."</td><td align=\"center\">"._BBFORUM_REPLIES."</td><td align=\"center\">"._BBFORUM_LASTPOSTER."</td></tr>";
$content .= "$Topic_Buffer";
$content .= "<tr><td align=\"center\" colspan=\"6\">"._BBFORUM_TOTTOPICS."<b>$Amount_Of_Topics</b> <b /b> "._BBFORUM_TOTPOSTS."<b>$Amount_Of_Posts</b> <b /b> "._BBFORUM_TOTVIEWS."<b>$Amount_Of_Topic_Views</b> <b /b> "._BBFORUM_TOTREPLIES."<b>$Amount_Of_Topic_Replies</b> <b /b> <a href=\"members.html\">"._BBFORUM_TOTMEMBERS."</a> <b>$Amount_Of_Members</b></center></td></tr>";
$content .= "<tr><td align=\"center\" colspan=\"6\">[ <a href=\"forums.html\">"._BBFORUM_FORUM."</a> ] [ <a href=\"modules.php?op=modload&name=Forums&file=search\">"._BBFORUM_SEARCH."</a> ]</center></td></tr>";
$content .= "</table>";
?>
|
Not Sure What To Change To Make It Work |
|
|