Forums and Subforums on the subpage.
#5
There are many ways to separate them. For example, run this query (which could be changed to simple_select() btw):
$query = $db->query("
    SELECT *
    FROM {$db->table_prefix}forums
    WHERE active != 0 AND fid IN(1,4,5) OR pid IN(1,4,5)
    ORDER BY pid, disporder
");
Then in the while loop, in which $forum is array from the database, do:
if(in_array($forum['pid'], array(1,4,5)))
    // child, so concantenate the subforum to an array with forum-specific indexing, for example $subforums[$forum['pid']]
else
    // parent, so print forum's template with $subforums[$forum['fid']] representing children. IIRC you'll probably need to reassign it to another simplier variable to avoid "security issue" error.

EDIT: I forgot it may not work properly with that ORDER. You need:
$query = $db->query("
    SELECT *
    FROM {$db->table_prefix}forums
    WHERE active != 0 AND fid IN(1,4,5) OR pid IN(1,4,5)
    ORDER BY FIELD(pid,1,4,5), disporder
");
or a similar solution with CASE WHEN.
Reply


Messages In This Thread
Forums and Subforums on the subpage. - by Snake_ - 2015-04-23, 03:55 PM
RE: Forums and Subforums on the subpage. - by Destroy666 - 2015-04-27, 07:53 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)