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

Event listener error

Discussion in 'XenForo Development Discussions' started by Scarface, Jun 12, 2014.

  1. Scarface

    Scarface Member

    Ok so i have view the video on how to do template hook with this http://xenforo.com/community/threads/how-to-use-template-hooks.13167/
    But i cant get it to work. Why?

    Server eror log


    Screenshot
    1.png 2.png

    Code i used
    Code:
    <?php
    
    class KnightRider_Listener
    {
        public static function templateHook($hookName, &$contents, array $hookParams, XenForo_Template_Abstract $template)
        {
            if ($hookName == 'footer_after_copyright')
            {
                $contents .= <li><a href="http://slickmovie.com" class="Tooltip" title="SlickMovie - Free style provided by SlickMovie. Enjoy! ">Style by SlickMovie</a></li>';
            }
        }
    }
    Please help thank you
     
    Last edited: Jun 12, 2014
  2. Valhalla

    Valhalla Well-Known Member

    You should use the Template Modification System instead.

    For your method, it should be:

    PHP:
    public static function templateHook($hookName, &$contents, array $hookParamsXenForo_Template_Abstract $template)
    {
        if (
    $hookName == 'footer_after_copyright')
        {
            
    $contents .= '<li><a href=""></a></li>';
        }
    }
     
  3. Liam W

    Liam W Well-Known Member

    You missed the start quote on your HTML string :)
     
    Scarface likes this.
  4. Scarface

    Scarface Member

    omg it was right in front of my eyes thanks :p you rock
     
  5. Liam W

    Liam W Well-Known Member

    Which is why I use an IDE ;)
     
  6. Scarface

    Scarface Member

    what do you recommend? i am very new to this and want to learn
     
  7. Liam W

    Liam W Well-Known Member

    PHPStorm has grown on me :)
     
    Scarface likes this.
  8. Scarface

    Scarface Member

    thanks downloading this right now
     

Share This Page