I used the basis of the hack. Modified extremely... and works great. Does not generate many extra queries, and is damn fast.
Features added :
- Bold on new messages
- custom forum type
- variable number of columns to display per parents children
added 2 fields to forum table showas and numcols
this is the index.php version. For the forumdisplay.php
there is some stuff to comment out ( or in) dependeing on your requirements (sorts out spacing before and after subforum lists)
here is the code, I do not support it, have fun .....
PHP Code:
// ********************************************************************
// ADDED BY ERK
// ********************************************************************
$subforums=$DB_site->query("select title,forumid,lastpost,replycount,threadcount,showas,numcols from forum where parentid = $forum[forumid] and active != 0 ORDER BY parentid,displayorder");
if ($DB_site->num_rows($subforums)>0)
{
$subs = "<smallfont><table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" align=\"center\" id=\"ltlink\" ><tr valign=\"top\"> ";
// switch on showas
switch ($forum_child[showas])
{
// FULL AFFILIATES
case "AFF":
$subs.="<font class=\"sf\" color=\"darkblue\">$child_text</font></a><img src=\"$bburl/images/star.gif\">";
break;
case "AFF_AS":
$subs.="<font class=\"sf\" color=\"white\">$child_text</font></a><img src=\"$bburl/images/star.gif\">";
break;
// VENDOR MODERATED
case "VEN":
$subs.="<font class=\"sf\" color=\"black\">$child_text</font></a><img src=\"$bburl/images/posticonnew.gif\">";
break;
// CONTRIBUTOR MODERATED
case "CON":
$subs.="<font class=\"sf\" color=\"darkgreen\">$child_text</font></a><img src=\"$bburl/images/paperclip.gif\">";
break;
// USENET FORUM ENTRIES
case "USE":
$subs.="<font class=\"sf\" color=\"brown\">$child_text</font></a><img src=\"$bburl/images/posticon.gif\">";
break;
// MEMBER MODERATED
case "MEM":
$subs.="<font class=\"sf\" color=\"darkorange\">$child_text</font></a>";
break;
// HIDDEN
case "LOW":
$subs.="<font class=\"sf\" color=\"#999999\">$child_text</font></a>";
break;
// DEFAULT
default:
// -------------------------------
// set entry to italic if no posts
// -------------------------------
// if ($forum_child[threadcount] == 0 ){
// $subs.="<font class=\"sf\" color=\"black\"><i>$child_text</i></font></a>";
// } else {
$subs.="<font class=\"sf\" color=\"black\">$child_text</font></a>";
// }
break;
} // end switch
// ---------------------
// tag on the replycount
// ---------------------
// if ($forum_child[threadcount] > 0 ){
// $subs.="<font class=\"sf\" color=\"#999999\"> <i>Posts($forum_child[replycount])</i></font>";
// }
// ---------------------------------------
// check if i need to go to new column yet
// ---------------------------------------
if ($cur_row == $num_rows) {
$cur_row=1; $subs.= "</td></tr></table></td>";
}
else {
$cur_row++;
$subs.="</td></tr></table>";
}
} // end-if
} // end-while
// -------------------------------------
// close off the remaining empty columns
// and finish off the table etc..
// -------------------------------------
$todo_cols = $num_cols - $cur_col;
while ($todo_cols != 0)
{
$subs.="<td width=\"$col_width%\"></td>" ;
$todo_cols--;
}
$subs.="</tr></table></smallfont>";
if ($forum['description'] != '') {
$forum['description'].= "<br><br>$subs<br>";
}
else {
$forum['description'].= "<br>$subs"; // used in index.php
// $forum['description'].= "<br>$subs<br>"; // used in forumdisplay.php
}
$subs=null;
} // end-if
else {
if ($forum['description'] != '') {
// $forum['description'].= "<br><br>"; // used in forumdisplay.php
}
else {
// $forum['description'].= "<br>"; // used in forumdisplay.php
}
// ********************************************************************
// END ADDED
// ********************************************************************
Warning: Division by zero in /usr/local/httpd/htdocs/kunden/web14/html/forum/index.php on line 344
Warning: Division by zero in /usr/local/httpd/htdocs/kunden/web14/html/forum/index.php on line 345
Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 20 bytes) in /usr/local/httpd/htdocs/kunden/web14/html/forum/index.php on line 456
I'd like to use this but have a problem I can't pinpoint. The subforum titles appear hyperlinked in the parent forum title on the home page BUT it looks like this:
hi there, need help ^ ^
the sub-forums in the forum home show well, but my problem is those sub-forums didnt have a hyperlink to them so that after i added this, it is just only to show the name of the sub-forums ( cant access them in the forum home, there is NO links )
slove me this please