PDA

View Full Version : Using existing template hooks


MrEyes
01-25-2010, 12:09 PM
Today I have started working with VB4 for the first time and I seem to be having a blonde moment.

I would like to add an additional item to the navbar in the items listed below "Forum" inbetween "New Posts" and "Private Messages". Fortunately for me there is a template hook for this in the navbar template.

{vb:raw template_hook.navbar_after_getnew}

I have create a template (mymod_navbar_link) for the link I am adding:


<li>
<a href="somewhere.php">Somewhere</a>
</li>


I have also created a plugin for the "process_templates_complete" hook location, the code for this plugin is:


$templater = vB_Template::create('mymod_navbar_link');
$template_hook['navbar_after_getnew'] .= $templater->render();


However the link does not appear.

I know the code above is working as if I change this to:


$templater = vB_Template::create('mymod_navbar_link');
$template_hook['navbar_after_getnew'] .= $templater->render();
echo $template_hook['navbar_after_getnew'];
exit;


I see that the template markup is in the $template_hook array.

So what obvious thing have I missed?

--------------- Added 1264430546 at 1264430546 ---------------

So what obvious thing have I missed?

The obvious thing was that I was running that code in a included php file and was not using the global $template_hook variable.:rolleyes:

BBR-APBT
01-25-2010, 12:50 PM
Take a peek at https://vborg.vbsupport.ru/showthread.php?t=232579