vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   So how do you use template hooks? (https://vborg.vbsupport.ru/showthread.php?t=191282)

DISLEX 09-19-2008 01:30 AM

So how do you use template hooks?
 
So there's this hook under the navbar:

$template_hook[navbar_quick_links_menu_pos1]

I want to be able to use a plugin to add more to the menu, so I have less template modifications (that way I don't have to keep redoing templates every vBulletin update)

How can I manage that? Can I just have a plugin hooked on global_start, and then do

$template_hook[navbar_quick_links_menu_pos1] .= "<tr>etc</tr>";

?

Quarterbore 09-19-2008 02:18 AM

Really easy. Just create a plugin that will run when you have what you need in memory but before it is output to the template.

Here is one you can try to see how it works, yea it is spam so delete it when you are done :D

New plugin:

Hook Location: member_complete
Title: Quarterbore's Spam
Plugin PHP Code:

PHP Code:

$template_hook['memberinfo_foruminfo']  .= '
<fieldset class="smallfont"><legend>Visit vBClassified.com</legend>
<table cellpadding="0" cellspacing="3" border="0"><tr><td><div>
<a href="http://www.vbclassified.com">vBClassified.com</a>
</div></td></tr></table></fieldset>'


Easy as pie!

Lynne 09-19-2008 02:22 AM

There are two methods. One as shown above, and the other using another template. See this article - Template Hook


All times are GMT. The time now is 08:26 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.00951 seconds
  • Memory Usage 1,713KB
  • 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)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)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