vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   PHP array: Forum tree structure on non-vB pages (https://vborg.vbsupport.ru/showthread.php?t=112400)

zlos 04-07-2006 03:41 PM

PHP array: Forum tree structure on non-vB pages
 
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:

PHP Code:

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 ;)
PHP Code:

$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

mschvili 07-27-2006 05:40 PM

I want to mix the capability of a forum with a document structure.

I am right now trying the Linked and Download Manager but it doesn't contain any structure.

Is it possible?
//Matti


All times are GMT. The time now is 04:42 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01026 seconds
  • Memory Usage 1,714KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (2)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete