vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Using existing template hooks (https://vborg.vbsupport.ru/showthread.php?t=234119)

MrEyes 01-25-2010 12:09 PM

Using existing template hooks
 
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.

Quote:

{vb:raw template_hook.navbar_after_getnew}
I have create a template (mymod_navbar_link) for the link I am adding:

Code:

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

Code:

$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:

Code:

$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 [DATE]1264430546[/DATE] at [TIME]1264430546[/TIME] ---------------

Quote:

Originally Posted by MrEyes (Post 1966077)
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


All times are GMT. The time now is 12:03 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.01087 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
  • (3)bbcode_code_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (2)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