Alright, since I'm too lazy to get the latest CVS to see how this is done, could someone tell me how the jumpbox lists all forums?
I mean, is this recursion, or is there a database field that tells how many levels in a forum is?
thanks
Subforum question
Forum rules
Discuss features as they are added to the new version. Give us your feedback. Don't post bug reports, feature requests, support questions or suggestions here. Feature requests are closed.
Discuss features as they are added to the new version. Give us your feedback. Don't post bug reports, feature requests, support questions or suggestions here. Feature requests are closed.
Subforum question
-----BEGIN GEEK CODE BLOCK-----
GCS d- s:- a---- C++++ UL++++ P+ L+++ E- W+++ N+ o K+ w---
O- M+ V-- PS+++ PE-- Y+ PGP t 5 X R tv-- b++ DI+ D+
G e-- h! r-- y
------END GEEK CODE BLOCK------
GCS d- s:- a---- C++++ UL++++ P+ L+++ E- W+++ N+ o K+ w---
O- M+ V-- PS+++ PE-- Y+ PGP t 5 X R tv-- b++ DI+ D+
G e-- h! r-- y
------END GEEK CODE BLOCK------
-
- Registered User
- Posts: 28
- Joined: Sat May 31, 2003 7:18 am
- Location: Netherlands - lelystad
Re: Subforum question
Code: Select all
parent forum 1,0
child forum 1,1
child forum 1,1
childforum 1,2
sub child forum 2,1
sub child forum 2,1
parent forum 3,0
parent forum 4,0
child forum 4,1
child forum 4,5
sub child forum 5,1
sub child forum 5,1
childforum 4,1
parent forum 6,0
Last edited by jeroen234 on Sat May 31, 2003 7:50 am, edited 1 time in total.
Re: Subforum question
Just look at the jumpbox here (bottom of page on the right)
Images in sigs! please.
-
- Registered User
- Posts: 9
- Joined: Fri Dec 14, 2001 4:06 pm
- Location: space... that which matter occupies
- Contact:
Re: Subforum question
I believe ur talking about the php code behind it
it uses a handy little function called get_forum_parents():
I haven't figured out the left and right id stuff yet :S
it uses a handy little function called get_forum_parents():
Code: Select all
// Returns forum parents as an array. Get them from forum_data if available, or update the database otherwise
function get_forum_parents($forum_data)
{
global $db;
$forum_parents = array();
if ($forum_data['parent_id'] > 0)
{
if ($forum_data['forum_parents'] == '')
{
$sql = 'SELECT forum_id, forum_name
FROM ' . FORUMS_TABLE . '
WHERE left_id < ' . $forum_data['left_id'] . '
AND right_id > ' . $forum_data['right_id'] . '
ORDER BY left_id ASC';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$forum_parents[$row['forum_id']] = $row['forum_name'];
}
$db->sql_freeresult($result);
$sql = 'UPDATE ' . FORUMS_TABLE . "
SET forum_parents = '" . $db->sql_escape(serialize($forum_parents)) . "'
WHERE parent_id = " . $forum_data['parent_id'];
$db->sql_query($sql);
}
else
{
$forum_parents = unserialize($forum_data['forum_parents']);
}
}
return $forum_parents;
}
Last edited by sj26 on Fri Jun 06, 2003 7:48 am, edited 1 time in total.
Sj26
*does a little dance, makes a little love, praises the UCP*
Umm... I can't change my e-mail address
*does a little dance, makes a little love, praises the UCP*
Umm... I can't change my e-mail address
-
- Registered User
- Posts: 9
- Joined: Fri Dec 14, 2001 4:06 pm
- Location: space... that which matter occupies
- Contact:
Re: Subforum question
OK, well, it doesn't, but that's the main forum-parent getting function... the actual make_jumpbox() function is:
Code: Select all
function make_jumpbox($action, $forum_id = false, $select_all = false)
{
global $auth, $template, $user, $db, $phpEx, $SID;
$boxstring = '';
$sql = 'SELECT forum_id, forum_name, parent_id, forum_type, left_id, right_id
FROM ' . FORUMS_TABLE . '
ORDER BY left_id ASC';
$result = $db->sql_query($sql, 600);
$right = $cat_right = $padding_inc = 0;
$padding = $forum_list = $holding = '';
$padding_store = array('0' => '');
while ($row = $db->sql_fetchrow($result))
{
if ($row['forum_type'] == FORUM_CAT && ($row['left_id'] + 1 == $row['right_id']))
{
// Non-postable forum with no subforums, don't display
continue;
}
if (!$auth->acl_get('f_list', $row['forum_id']))
{
// if the user does not have permissions to list this forum skip
continue;
}
if ($row['left_id'] < $right)
{
$padding .= ' ';
$padding_store[$row['parent_id']] = $padding;
}
else if ($row['left_id'] > $right + 1)
{
$padding = $padding_store[$row['parent_id']];
}
$right = $row['right_id'];
$selected = ($row['forum_id'] == $forum_id) ? ' selected="selected"' : '';
if ($row['left_id'] > $cat_right)
{
$holding = '';
}
if ($row['right_id'] - $row['left_id'] > 1)
{
$cat_right = max($cat_right, $row['right_id']);
$holding .= '<option value="' . $row['forum_id'] . '"' . $selected . '>' . $padding . $row['forum_name'] . '</option>';
}
else
{
$boxstring .= $holding . '<option value="' . $row['forum_id'] . '"' . $selected . '>' . $padding . $row['forum_name'] . '</option>';
$holding = '';
}
}
$db->sql_freeresult($result);
unset($padding_store);
if ($boxstring != '')
{
$boxstring = (($select_all) ? '<option value="0">' . $user->lang['ALL_FORUMS'] : '<option value="-1">' . $user->lang['SELECT_FORUM']) . '</option><option value="-1">-----------------</option>' . $boxstring;
}
$template->assign_vars(array(
'S_JUMPBOX_OPTIONS' => $boxstring,
'S_JUMPBOX_ACTION' => $action)
);
return;
}
Sj26
*does a little dance, makes a little love, praises the UCP*
Umm... I can't change my e-mail address
*does a little dance, makes a little love, praises the UCP*
Umm... I can't change my e-mail address
Re: Subforum question
In which file would I find this code?
sj26 wrote:OK, well, it doesn't, but that's the main forum-parent getting function... the actual make_jumpbox() function is:Code: Select all
function make_jumpbox($action, $forum_id = false, $select_all = false) { // Shortened to aviod long and needless post. return; }
Re: Subforum question
includes/functions.phphasten wrote:In which file would I find this code?
Re: Subforum question
Thsnks, DoD.
- SHS`
- Registered User
- Posts: 1628
- Joined: Wed Jul 04, 2001 9:13 am
- Location: The Boonies, Hong Kong
- Contact:
Re: Subforum question
It's unsupported, as has been said many many many times before... if you can't work it out by yourself... don't mess with CVS code.hasten wrote:Thsnks, DoD.
Anyone asking for support or providing support for 2.1/2.2 CVS are likely to make developers rather miffed, which further delays this forcoming version version.
Jonathan “SHS`” Stanley • 史德信
phpBB™ 3.1.x, Bug/Security trackers
phpBB™ Bertie Bear 3.0 — prosilver Edition! • Asking Questions The Smart Way
phpBB™ 3.1.x, Bug/Security trackers
phpBB™ Bertie Bear 3.0 — prosilver Edition! • Asking Questions The Smart Way