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

Reply
 
Thread Tools Display Modes
  #1  
Old 09-10-2008, 11:13 AM
veenuisthebest's Avatar
veenuisthebest veenuisthebest is offline
 
Join Date: Mar 2008
Location: India
Posts: 1,416
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Regarding hooks

hii..

can anyone tell me how do we identify hook from the template.

like we have $template_hook[profile_ministats_list] in memberinfo_block_ministats template. Now, I don't see any hook with that name in the hooks list. So, how to code at that part ?
Reply With Quote
  #2  
Old 09-10-2008, 06:18 PM
Guest190829
Guest
 
Posts: n/a
Default

Template hooks at PHP hooks are different...you need to use a PHP hook to hook template code into a template hook. (If that makes sense.)

So, if I wanted to add some display code to the postbit without a template edit, I'd add a plugin to the postbit_display_complete hook (I believe off the top of my head.) and utilize one of the template hooks in the postbit.

I'll post some specific code if no one else does by the time I get back to my dorm.
Reply With Quote
  #3  
Old 09-10-2008, 06:37 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

These are two plugin examples from this thread - Template Hook

Using the $template_hook['navbar_buttons_left'] to insert stuff directly using html:
PHP Code:
$template_hook['navbar_buttons_left'] .= '<td class="vbmenu_control"><a href="index.php">Home Page</a></td>'
Using the $template_hook[navbar_buttons_left] to insert stuff from the 'new_navbar_item' template:
PHP Code:
eval('$template_hook[navbar_buttons_left] .= "' fetch_template('new_navbar_item') . '";'); 
Reply With Quote
  #4  
Old 09-11-2008, 05:19 AM
veenuisthebest's Avatar
veenuisthebest veenuisthebest is offline
 
Join Date: Mar 2008
Location: India
Posts: 1,416
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thank you so much lynne !

btw, do I always have to use global_start hook to use template hooks ? for eg. for $template_hook[profile_ministats_list] in memberinfo_block_ministats template, which php hook should I use ?
Reply With Quote
  #5  
Old 09-11-2008, 05:56 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You don't want to run your code on every page load unless it will need to be used every page load.

Choose a hook that will always be run when the template you are hooking into is running as well.
Reply With Quote
  #6  
Old 09-11-2008, 06:23 AM
veenuisthebest's Avatar
veenuisthebest veenuisthebest is offline
 
Join Date: Mar 2008
Location: India
Posts: 1,416
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

yes I do not want to run my code on every page load.

that is what I asked:-

"for $template_hook[profile_ministats_list] in memberinfo_block_ministats template, which php hook should I use ?"
Reply With Quote
  #7  
Old 09-11-2008, 06:59 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Why don't you have a look yourself?
Reply With Quote
  #8  
Old 09-11-2008, 07:16 AM
veenuisthebest's Avatar
veenuisthebest veenuisthebest is offline
 
Join Date: Mar 2008
Location: India
Posts: 1,416
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

oh sir that is what i asked in my first post !!

"how do we identify hook from the template?"

I DID tried to check it from the hooks list but I do not found any for $template_hook[profile_ministats_list]
Reply With Quote
  #9  
Old 09-11-2008, 09:12 AM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

First do a "Search in Templates" find out which template uses that template hook.

Look at the name of the hook it tells you.

PROFILE - This means the members profile page so member.php ?
MINISTAT - Mini-statistics block
LIST - The list section

vBulletin make sure they name each one to give as much information. So know you know what file it will probably execute in you can choose a hook from there.
Reply With Quote
  #10  
Old 09-11-2008, 06:06 PM
veenuisthebest's Avatar
veenuisthebest veenuisthebest is offline
 
Join Date: Mar 2008
Location: India
Posts: 1,416
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks opserty !

Now, I find 5 hooks in member.php:-

member_start
member_start_fetch_user
member_execute_start
member_build_blocks_start
member_complete

I tried the following code at all the above 5 hooks but none of them show the output in the Mini Statistics Box.

PHP Code:
$template_hook[profile_ministats_list] .= '<dt class="shade">Star Sign</dt>
<dd>Virgo</dd>'

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 02:30 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.10372 seconds
  • Memory Usage 2,252KB
  • Queries Executed 11 (?)
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
  • (3)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (9)postbit_onlinestatus
  • (10)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_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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete