Log in

View Full Version : So how do you use template hooks?


DISLEX
09-19-2008, 01:30 AM
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:


$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 (https://vborg.vbsupport.ru/showthread.php?t=147447&highlight=template_hook)