vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Regarding hooks (https://vborg.vbsupport.ru/showthread.php?t=190547)

veenuisthebest 09-10-2008 11:13 AM

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 ?

Guest190829 09-10-2008 06:18 PM

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.

Lynne 09-10-2008 06:37 PM

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') . '";'); 


veenuisthebest 09-11-2008 05:19 AM

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 ?

Dismounted 09-11-2008 05:56 AM

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.

veenuisthebest 09-11-2008 06:23 AM

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 ?"

Dismounted 09-11-2008 06:59 AM

Why don't you have a look yourself? ;)

veenuisthebest 09-11-2008 07:16 AM

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]

Opserty 09-11-2008 09:12 AM

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. ;)

veenuisthebest 09-11-2008 06:06 PM

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>'




All times are GMT. The time now is 09:24 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.01131 seconds
  • Memory Usage 1,738KB
  • 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
  • (3)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete