Author |
Message |
BamBamPSK
Regular
![Regular Regular](modules/Forums/images/ranks/2stars.gif)
![](modules/Forums/images/avatars/Animaniacs/Animaniacs_-_Brain.gif)
Joined: Nov 11, 2003
Posts: 61
|
Posted:
Mon Jan 19, 2004 6:21 pm |
|
hey raven you are the man when it comes to php coding so i come here to get help..thanks you for your site
and now for my "thing"
i have a scrolling forums block on my site that i LOVE it puts dividers between entries but it doesnt do exactly what i want it to do.
it shows the forums i want it to but it counts the "private" forums for the count in the block itself.
like if i had say 6 entries in the public forums and 4 in the private forums the count in the forums block is 6 not 10 like i would like it to be..
hope that makes sense....any who here is the code for the block if i could get it to show and count ONLY the public forums that would be great.
Code:if (eregi("block-Forums.php", $_SERVER['PHP_SELF'])) {
Header("Location: index.php");
die();
}
############################################
#### To remove top fixed link of forum put 0
$toplink = 1;
############################################
#### To stop scroll put 0
$scroll = 1;
############################################
#### To remove the counter put 0
$number = 0;
############################################
#### To remove the search link put 0
$search = 1;
############################################
include_once ('blocks/smileys.php');
$ThemeSel = get_theme();
global $sitename, $prefix, $db, $ThemeSel;
$count = 1;
if ($toplink == 1) {
$content .= "<center><a href=\"forums.html\"><b>$sitename Forums</b></a></center><br>";
}
if ($scroll == 1) {
$content .="<A name= \"scrollingCode\"></A>";
$content .="<MARQUEE behavior= \"scroll\" align= \"center\" direction= \"up\" height=\"220\" scrollamount= \"2\" scrolldelay= \"20\" onmouseover='this.stop()' onmouseout='this.start()'>";
$content .="<br>";
#####################################################################################
################# This will only appear if it's scrolling ###########################
$content .="<center><b>Last 10 Messages</b></center><br>";
}
#####################################################################################
############# To change the number of posts change the number in the end of this line
$sql = "SELECT topic_title, topic_last_post_id, forum_id FROM ".$prefix."_bbtopics ORDER BY topic_last_post_id DESC LIMIT 10";
#####################################################################################
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)){
$topic_title = $row[topic_title];
$topic_last_post_id = $row[topic_last_post_id];
$forum_id = $row[forum_id];
$sql = "SELECT forum_id, forum_name FROM ".$prefix."_bbforums where forum_id='$forum_id'";
$result2 = $db->sql_query($sql);
$row = $db->sql_fetchrow($result2);
$forum_id = $row[forum_id];
$forum_name = $row[forum_name];
$sql = "SELECT poster_id, FROM_UNIXTIME(post_time,'%b %d, %Y at %T') as post_time FROM ".$prefix."_bbposts where post_id='$topic_last_post_id'";
$result3 = $db->sql_query($sql);
$row = $db->sql_fetchrow($result3);
$poster_id = $row[poster_id];
$post_time = $row[post_time];
$sql = "SELECT username, user_id FROM ".$prefix."_users where user_id='$poster_id'";
$result4 = $db->sql_query($sql);
$row = $db->sql_fetchrow($result4);
$username = $row[username];
$user_id = $row[user_id];
$sql2 = "SELECT auth_view, auth_read FROM ".$prefix."_bbforums WHERE forum_id='$forum_id'";
$result5 = $db->sql_query($sql2);
$row2 = $db->sql_fetchrow($result5);
$auth_view = $row2[auth_view];
$auth_read = $row2[auth_read];
if (($auth_view < 2) OR ($auth_read < 2)) {
if ($number == 1) {
$content .= "<table><tr><td><b>Message: $count<br></b></td></tr>";
} else {
$content .= "<table>";
}
$topic_title=parseEmoticons($topic_title);
if (file_exists("themes/$ThemeSel/forums/images/icon_minipost.gif")) {
$content .= "<tr><td><img src=\"themes/$ThemeSel/forums/images/icon_minipost.gif\" border=\"0\" alt=\"\"><a href=\"modules.php?name=Forums&file=viewtopic&p=$topic_last_post_id#$topic_last_post_id\" STYLE=\"text-decoration: none\"><b> $topic_title </b><br></a>Last Message by <A HREF=\"forum-userprofile-.html$user_id\"STYLE=\"text-decoration: none\"> <i><strong>$username</strong></i> </a> in <a href=\"modules.php?name=Forums&file=viewforum&f=$forum_id\" STYLE=\"text-decoration: none\"><b>$forum_name</b></a> on <i><strong>$post_time</strong></i><hr></td></tr></table>";
} else {
$content .= "<tr><td><img src=\"modules/Forums/templates/subSilver/images/icon_minipost.gif\" border=\"0\" alt=\"\"><a href=\"modules.php?name=Forums&file=viewtopic&p=$topic_last_post_id#$topic_last_post_id\" STYLE=\"text-decoration: none\"><b> $topic_title </b><br></a>Last Message by <A HREF=\"forum-userprofile-.html$user_id\"STYLE=\"text-decoration: none\"> <i><strong>$username</strong></i> </a> in <a href=\"modules.php?name=Forums&file=viewforum&f=$forum_id\" STYLE=\"text-decoration: none\"><b>$forum_name</b></a> on <i><strong>$post_time</strong></i><hr></td></tr></table>";
}
}
$count = $count + 1;
}
if ($toplink == 0) {
$content .= "<center><a href=\"forums.html\"><b>$sitename Forums</b></a></center><br>";
}
if ($scroll == 1){
$content .= "</MARQUEE>";
}
if($search == 1){
$content .= "<center><a href=\"modules.php?name=Forums&file=search\"><b>Search Forums</b></a></center><br>";
}
?>
|
|
_________________
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
BamBamPSK
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Tue Jan 20, 2004 7:07 am |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Raven
Site Admin/Owner
![](modules/Forums/images/avatars/45030c033f18773153cd2.gif)
Joined: Aug 27, 2002
Posts: 17088
|
Posted:
Tue Jan 20, 2004 7:33 am |
|
I'm not clear on what you want. If you have 6 in public and 4 in private, do you want to only see the public count, which would be 6? |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
BamBamPSK
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Tue Jan 20, 2004 1:56 pm |
|
ok ill try to explain better....
the block says it will show the last 10 forum messages BUT it really doesnt unless those messages are in the public forums.
when my clan members post in the private section or i and the other admins post in the admin section then those posts count in the forums block...what i want it for those posts NOT to count in the block.
hope that explains it better |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Raven
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Tue Jan 20, 2004 2:06 pm |
|
A quick and dirty way might be to alter this line of code fromCode:$sql = "SELECT topic_title, topic_last_post_id, forum_id FROM ".$prefix."_bbtopics ORDER BY topic_last_post_id DESC LIMIT 10";
| toCode:$sql = "SELECT topic_title, topic_last_post_id, forum_id FROM ".$prefix."_bbtopics WHERE forum_id NOT IN('ID1','ID2') ORDER BY topic_last_post_id DESC LIMIT 10";
|
Of course you need to hard code in the ID1, ID2, etc., with real forum ID's to exclude. It could be written automatically with an SQL join or 2, but if you have just a couple forums to block this would be easier. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
BamBamPSK
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Tue Jan 20, 2004 5:47 pm |
|
i have 4 total to block and how would i hard code it in? |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Raven
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Tue Jan 20, 2004 6:14 pm |
|
??? I gave you the code in my above message ![Laughing](modules/Forums/images/smiles/icon_lol.gif) |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
BamBamPSK
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Tue Jan 20, 2004 6:45 pm |
|
Raven wrote: |
Of course you need to hard code in the ID1, ID2, etc., with real forum ID's to exclude. It could be written automatically with an SQL join or 2, but if you have just a couple forums to block this would be easier. |
|
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Raven
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Tue Jan 20, 2004 6:53 pm |
|
This is the code I gave you, in that same postCode:$sql = "SELECT topic_title, topic_last_post_id, forum_id FROM ".$prefix."_bbtopics WHERE forum_id NOT IN('ID1','ID2') ORDER BY topic_last_post_id DESC LIMIT 10";
|
|
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
|