vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   $forum array... where? (https://vborg.vbsupport.ru/showthread.php?t=108427)

mdevour 02-19-2006 11:59 PM

$forum array... where?
 
I'm trying to understand the code better before attempting a modification to the forumhome_forumbit_level1_nopost template.

Where does the $forum array variable come from? Where is it declared, initialized, assigned values, whatever? What is its scope? What does it contain?

As far as I can tell, the Code Documentation in the Members Area does not include an index by variable, so how else can I find information about them?

What is a better way to answer this question for myself, rather than asking random questions like this on the forum? I'm barely starting to understand PHP, so I don't know the tools or techniques yet. Please point me in the right direction!

Thanks!

Mike D.

Andreas 02-20-2006 12:19 AM

Best way: Lookup where the Template (forumhome_forumbit_level) is being called, and you will see the context, scope of variables, etc.

Hint: construct_forum_bit() in functions_forumlist.php

mdevour 02-20-2006 01:03 AM

Thank you for your time, Andreas.

I've already traced program flow all the way from index.php down to construct_forum_bit()... But at that point the $forum array is being used heavily, having already been declared and assigned values. I need to see the part of the code where it's created.

I am very early in my effort to pick apart the vBulletin code base. I am beginning to be able to read PHP, though I'd be hard pressed to write it. I don't have a clue where I should begin to look, in this stack of dozens of php files, for the place where $forum is created and initialized (or modified).

Should I drop to a linux command line and grep something like '$forum = array'??? Or is there a framework for how the coders organized things that I need to know more about?

I'm trying to get to the point where I can answer questions like this for myself, so any foundational information you can see that I'm lacking, I would welcome.

Thanks again,

Mike D.

Andreas 02-20-2006 01:17 AM

In construct_forum_bit you can find this line:

PHP Code:

$forum $vbulletin->forumcache["$forumid"]; 

$vbulletin->forumcache is the unserialized array from table datastore, title = forumcache

The cache is build from table forum by build_forum_permissions() in includes/adminfunctions.php, when a forum is added/modified, permissions changed, etc.

As this is cached data, it does not necessarily contain the current values for replies, threads, etc.

This is where cache_ordered_forums() comes into play:
It reads the current data from table forum (and other tables if necessary), merges them into $vbulletin->forumcache

To answer such questions yourself, you have to track down the data flow.

mdevour 02-20-2006 02:11 AM

D'oh!

And if I hadn't read past the line in construct_forum_bits() that calls fetch_last_post_array(), I'd have been able to find out where $forum was defined by looking up fetch_last_post_array() in the Code Documentation, which would have gotten me to look in functions_forumlist.php again, about 3 screenfuls above where I was at already. <sigh>

Okay, now I just have to study build_forum_permissions() to get my bearings on what they're putting in the cache.

This is excruciating.

Quote:

To answer such questions yourself, you have to track down the data flow.
You're absolutely right. Thanks, Andreas.

Mike D.


All times are GMT. The time now is 11:38 PM.

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.01037 seconds
  • Memory Usage 1,725KB
  • 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
  • (1)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)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