Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 02-19-2006, 11:59 PM
mdevour mdevour is offline
 
Join Date: Feb 2006
Posts: 26
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default $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.
Reply With Quote
  #2  
Old 02-20-2006, 12:19 AM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #3  
Old 02-20-2006, 01:03 AM
mdevour mdevour is offline
 
Join Date: Feb 2006
Posts: 26
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #4  
Old 02-20-2006, 01:17 AM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #5  
Old 02-20-2006, 02:11 AM
mdevour mdevour is offline
 
Join Date: Feb 2006
Posts: 26
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:21 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.03381 seconds
  • Memory Usage 2,198KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete