vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   $template_hook[postbit_start] (https://vborg.vbsupport.ru/showthread.php?t=228611)

leenster 11-22-2009 02:58 PM

$template_hook[postbit_start]
 
question about :$template_hook[postbit_start]

Hey guys, if i wanted to add something (a database call) to that hook, where would i do that...

keep in mind that i am not a vbulletin modder, but i do know php.....

please point me in the right direction...

thanks

Lynne 11-22-2009 03:21 PM

A template_hook is just for adding html into a template. You would actually want to use the plugin system to put in the database call and then spit the output into the $template_hook.

If you are just starting out, I'd recommended looking through the mods and finding one that is kinda like what you want (that adds something to the postbit) and looking at the code for that product.

leenster 11-22-2009 03:36 PM

Thanks for the quick reply Lynne

im not sure where to look for something i want :)

this is what i am trying to do...

I have a table in our db that gets updated with info from battletracker.com...

in the postbit i would like to show player stats from that table....

Lynne 11-22-2009 04:03 PM

Most likely, you would want to hook into the $post query and grab that information right then by doing a JOIN to your table.

hook location - showthread_query:
PHP Code:

$hook_query_fields .= ",yourtable.field as field";
$hook_query_joins .= "LEFT JOIN " TABLE_PREFIX "yourtable ON(whatever)"

And then in the postbit_display_start hook, something like:
PHP Code:

$template_hook[postbit_start] .= 'This field:' .$post[field]; 

Something like that. Play with it cuz I haven't tested it (obviously, since I don't have your tables).

leenster 11-22-2009 04:28 PM

Great, thanks for your help. i will give this a try..

your the bestestest, lol


All times are GMT. The time now is 10:41 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.01107 seconds
  • Memory Usage 1,716KB
  • 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
  • (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