vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   How to access $threadbits?? (https://vborg.vbsupport.ru/showthread.php?t=236453)

gcc.programmer 02-21-2010 02:34 AM

How to access $threadbits??
 
I've been called upon to do some modifications to vB 3.8.x, and though I'm a PHP programmer, I'm sure everyone here knows that doesn't mean squat for *knowing* how to code vB! I'm hoping to cut corners in having to read through a lot of source code.

I've done all the I suppose "regular" things, i.e. importing ./global.php, as well as some of the source from index.php to grab hold of some of the variables it exposes. A bit more difficult is finding the ellusive $threadbits. It appears that some of the db access done in forumdisplay.php may be what I need, but I don't find the actual variable $threadbits being built there.

Is there a resource I could be pointed to that breaks down vB databases, or even some source code someone might share that would allow me to grab $threadbits in my template?

I've essentially created a test.php file, and a TEST template, and am able to pull in, as I said, the info built in the index.php page.

Any guidance or wisdom would be greatly appreciated!

kh99 02-21-2010 10:54 AM

I just started myself around 6 months ago. There is no resource that I know of, unfortunately. I use grep a lot.

I think threadbits is built in forumdisplay like you said. Around line 959 $threadbit is set as a reference to either $threadbits or $threabit_sticky, then one or the other is added on to by evaling a template. (That's all in the loop getting records from the database).

If you have to read the db yourself, I use install/mysql-schema.php as a reference.

gcc.programmer 02-22-2010 05:11 PM

Thanks kh99.

Yeah, I noted that also, and attempted a few cut and paste permutations to try and set it up in my test.php file, making sure to do all the includes, etc. that were called for in forumdisplay, but thus far haven't found the right mojo. Only a small part of my failure can be attributed to being in a hurry. The bulk of my failure so far, I think, has more to do with the fact that this is apparently going to take some detailed study of forumdisplay.

I just hate to get into it that deeply, and re-invent the wheel when I feel that someone else must have already done it, and have the boilerplate code. So far though, it's looking more like I'm going to have to dig in.

Marco van Herwaarden 02-25-2010 10:56 AM

Did you go thru the information posted in our articles section?

gcc.programmer 03-02-2010 02:40 AM

Hello Marco:

Yes, in fact, I read fairly extensively on the forums and articles sections. In the end, for this and a few other things I needed to do, I just dug through the DB Schemas, and then accessed the things I needed directly from the database. A very quick, and very easy solution to the problem!

Thank you for taking the time to post.

Marco van Herwaarden 03-02-2010 08:14 AM

After including global.php, start by examining the $vbulletin array. You will find most information there.

gcc.programmer 03-03-2010 09:47 AM

Thanks again, Marco.

It looks like I will be getting my hands dirty inside of vB after all. This was actually a question due to my need to pull info out to then pass to outside of vB.

I ended up going to the database direct for a lot of the things, and also making use of external.php for it's javascript goodness. But I do appreciate the heads up. Now my boss wants some tweaks inside of vB too, so this gives me a good starting point.


All times are GMT. The time now is 06:46 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.01752 seconds
  • Memory Usage 1,720KB
  • 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)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)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