zlos
04-07-2006, 03:41 PM
Hi
I do have some difficulties in loading properly. Let me present the problem to you.
I load forum information from mysql query to an array.
Array after that looks like this one:
var_dump($array);
/* Result:
array(98)
{
[0]=> array(3) { [0]=> string(2) "1" [1]=> string(21) "Main forum A" [2]=> string(1) "0" }
[1]=> array(3) { [0]=> string(3) "2" [1]=> string(21) "SubForum 1" [2]=> string(2) "1" }
[2]=> array(3) { [0]=> string(3) "3" [1]=> string(21) "SubForum 2" [2]=> string(2) "1" }
[3]=> array(3) { [0]=> string(3) "4" [1]=> string(21) "Main forum B" [2]=> string(2) "0" }
etc. etc...
*/
This means, that I should now have the forums structure like this:
Main forum A
-- SubForum 1
-- SubForum 2
Main forum B
Looks simple, but I have 98 forums and the structure goes up to 4 levels deep. I am trying to construct a function, which would print tree structure on non vBulletin pages and have spent some hours without any results...
Any idea where to start?
For your reference: this is definitely WRONG way ;)
$p = sizeof($array);
for($i = 0; $i < $p; ++$i) {
if ($array[$i][2] == 0) // Main forum!
{
show_forum_link($array[$i][0]);
// here the problem starts...
// how the hell do I find subforums to the Main forum???
}
}
Regards
Tom
I do have some difficulties in loading properly. Let me present the problem to you.
I load forum information from mysql query to an array.
Array after that looks like this one:
var_dump($array);
/* Result:
array(98)
{
[0]=> array(3) { [0]=> string(2) "1" [1]=> string(21) "Main forum A" [2]=> string(1) "0" }
[1]=> array(3) { [0]=> string(3) "2" [1]=> string(21) "SubForum 1" [2]=> string(2) "1" }
[2]=> array(3) { [0]=> string(3) "3" [1]=> string(21) "SubForum 2" [2]=> string(2) "1" }
[3]=> array(3) { [0]=> string(3) "4" [1]=> string(21) "Main forum B" [2]=> string(2) "0" }
etc. etc...
*/
This means, that I should now have the forums structure like this:
Main forum A
-- SubForum 1
-- SubForum 2
Main forum B
Looks simple, but I have 98 forums and the structure goes up to 4 levels deep. I am trying to construct a function, which would print tree structure on non vBulletin pages and have spent some hours without any results...
Any idea where to start?
For your reference: this is definitely WRONG way ;)
$p = sizeof($array);
for($i = 0; $i < $p; ++$i) {
if ($array[$i][2] == 0) // Main forum!
{
show_forum_link($array[$i][0]);
// here the problem starts...
// how the hell do I find subforums to the Main forum???
}
}
Regards
Tom