vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   custom hook - hooks_custom.xml - how to reference? (https://vborg.vbsupport.ru/showthread.php?t=142003)

Rik Brown 03-14-2007 12:59 AM

custom hook - hooks_custom.xml - how to reference?
 
I need to create a custom hook to move the location of a 3rd party hack. So that the hook won't get overwritten in any future vb upgrade, I created a file named hooks_custom.xml in the forums/includes/xml directory. I've created a plugin named TEST that simply has a one-line php echo statement for testing purposes and I've been able to assign that plugin via the following dropdown menu:

Plugin Manager > Product : vBulletin > TEST > Hook Location ...

... to a new hook location named "left_column_top". So the hooks_custom.xml file is being read correctly.

However, I'm not sure how to reference the hook in the template in which we are placing it. Other messages about hooks show a reference such as:

PHP Code:

($hook vBulletinHook::fetch_hook('left_custom_top')) ? eval($hook) : false

... which doesn't work.

Would "vBulletinHook" need to changed to something like "customhooks" (I've tried several variation of that)?

Anyone know what I'm doing wrong?

Thanks. -- Rik

Zachariah 03-25-2007 02:45 PM

<hooks> - anything between this tag and </hooks> will be included in the drop down

<hooktype type="name"> - The name of your hook group, you should group all common hooks under a group so you can find them quickly. Make sure you don't use a name already used by a default hooktype.

<hook> - The name of your hook, this must be the same as the hook's name in the php code


XML file:
HTML Code:

<?xml version="1.0" encoding="ISO-8859-1"?>

<hooks>

        <hooktype type="Test">
        <hook>left_custom_top</hook>
        <hook>right_custom_top</hook>
        <hook>top_custom_top</hook>
        <hook>bottom_custom_top</hook>
        </hooktype>


</hooks>



I am assuming that you are working in a PHP file that includes /forums/includes/global.php.

PHP
PHP Code:

($hook vBulletinHook::fetch_hook('left_custom_top')) ? eval($hook) : false;
(
$hook vBulletinHook::fetch_hook('right_custom_top')) ? eval($hook) : false;
(
$hook vBulletinHook::fetch_hook('top_custom_top')) ? eval($hook) : false;
(
$hook vBulletinHook::fetch_hook('bottom_custom_top')) ? eval($hook) : false


Marco van Herwaarden 03-25-2007 08:06 PM

Quote:

Originally Posted by Rik Brown (Post 1202965)
However, I'm not sure how to reference the hook in the template in which we are placing it. Other messages about hooks show a reference such as:

PHP Code:

($hook vBulletinHook::fetch_hook('left_custom_top')) ? eval($hook) : false


You can not place PHP code in a template.

Rik Brown 03-26-2007 02:20 AM

Zachariah & Marco:

I'll give it a try again. Thanks for your comments and help. -- Rik


All times are GMT. The time now is 01:01 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.01018 seconds
  • Memory Usage 1,734KB
  • 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_html_printable
  • (3)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)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