1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Learning xen hooks (can't seem to get it to work)

Discussion in 'XenForo Development Discussions' started by Wuebit, Apr 17, 2011.

  1. Wuebit

    Wuebit Well-Known Member

    Well ive been trying to get a template to be added at a hook without any luck...
    If someone has time could you show me where ive gone wrong?

    This is my Listener

    PHP:
    <?php

    class VKtwitter_Listener_Template
    {
        public static function 
    templateCreate(&$templateName, array &$paramsXenForo_Template_Abstract $template)
        {
            switch (
    $templateName)
            {
                case 
    'member_view':
                {
                    
    $template->preloadTemplate('VKtwitter_main');
                    break;
                }
            }
        }
        public static function 
    templateHook($name, &$contents, array $paramsXenForo_Template_Abstract $template)
        {
            switch (
    $templateName)
            {
                case 
    'member_view_sidebar_middle2':
                {
                    
    $contents .= $template->create('VKtwitter_main'$template->getParams());
                    break;
                }
            }
        }
    }
    Thanks muchy :X3:
     
  2. Bob

    Bob Well-Known Member


    The switch in your 2nd method is wrong... should be switch ($name)
     
    Vodkaholic likes this.
  3. Wuebit

    Wuebit Well-Known Member

    Saw this post soon as I posted this >.>
    Aye fixed it in the end thanks :)
     
    Bob likes this.

Share This Page