vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Template Hooks - How to (https://vborg.vbsupport.ru/showthread.php?t=153081)

scoles15 07-22-2007 10:59 PM

Template Hooks - How to
 
I am trying to use the template hooks in Navbar and I am clearly missing something. I've searched the forums and articles and found a lot about doing this type of thing without the hooks and using string replace, but nothing about how to use the template hooks.

I've created a plugin:

PHP Code:

$template_hook['navbar_buttons_left'] =
'<td class="vbmenu_control"><a href="/index.php$session[sessionurl_q]">Home</a></td>
  <td class="vbmenu_control"><a href="/forums/index.php$session[sessionurl_q]">Forums</a></td>
  <td class="vbmenu_control"><a href="/pp/index.php$session[sessionurl_q]">Photo<br>Galleries</a></td>'


I tried several different code hooks and the only one that does anything is parse_templates. The entries are added to the menu bar, but $session[sessionurl_q] is not substituted for, it just shows as part of the link, so the link is bad. If I take $session[sessionurl_q] off the link then it works for some pages but not all.

I am obviously missing th whole point of how to do this. So if someone could show me an example of the right way and the correct hook, I'd be forever in your debt:confused:

Kirk Y 07-22-2007 11:13 PM

Give this a read: https://vborg.vbsupport.ru/showthread.php?t=147447

scoles15 07-23-2007 12:06 AM

Quote:

Originally Posted by Kirk Y (Post 1298622)

Thanks, but that's what I had already done. The same problem still exists. $session[sessionurl_q] is not evaluated.

Dismounted 07-23-2007 06:10 AM

Try:
PHP Code:

$template_hook['navbar_buttons_left'] =
'<td class="vbmenu_control"><a href="/index.php' $vbulletin->session->vars['sessionurl_q'] . '">Home</a></td>
  <td class="vbmenu_control"><a href="/forums/index.php' 
$vbulletin->session->vars['sessionurl_q'] . '">Forums</a></td>
  <td class="vbmenu_control"><a href="/pp/index.php' 
$vbulletin->session->vars['sessionurl_q'] . '">Photo<br>Galleries</a></td>'


scoles15 07-23-2007 08:10 AM

Quote:

Originally Posted by Dismounted (Post 1298806)
Try:
PHP Code:

$template_hook['navbar_buttons_left'] =
'<td class="vbmenu_control"><a href="/index.php' $vbulletin->session->vars['sessionurl_q'] . '">Home</a></td>
  <td class="vbmenu_control"><a href="/forums/index.php' 
$vbulletin->session->vars['sessionurl_q'] . '">Forums</a></td>
  <td class="vbmenu_control"><a href="/pp/index.php' 
$vbulletin->session->vars['sessionurl_q'] . '">Photo<br>Galleries</a></td>'


Thank you. That did it.:D

BTW, it wasn't necessary to use $vbulletin->session->vars['sessionurl_q'] the original
$session[sessionurl_q] works fine. My problem of course was forgeting to use the string concatenation:o


All times are GMT. The time now is 12:34 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.01085 seconds
  • Memory Usage 1,733KB
  • 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
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)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