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

template_post_render

Discussion in 'XenForo Development Discussions' started by DroidHost, Jun 9, 2011.

  1. DroidHost

    DroidHost Well-Known Member

    I am not sure if this is a bug or just me .....
    I want to Listen to Event : template_post_render
    I Use this code :
    PHP:
    class DroidHost_template
    {
        public function 
    modify($templateName, &$content, array &$containerDataXenForo_Template_Abstract $template)
        {
            if (
    $templateName == 'message_content thread_view')
            {
                die(
    $content);
            }
        }
    }
    and I have this err .........
    Code:
    An exception occurred: call_user_func_array() expects parameter 1 to be a valid callback, non-static method DroidHost_template::modify() should not be called statically in C:\xampp\htdocs\xen\library\XenForo\CodeEvent.php on line 54
    
        XenForo_Application::handlePhpError()
        call_user_func_array() in XenForo/CodeEvent.php at line 54
        XenForo_CodeEvent::fire() in XenForo/Template/Abstract.php at line 195
        XenForo_Template_Abstract->render() in XenForo/Template/Public.php at line 100
        XenForo_Template_Public->render() in XenForo/ViewRenderer/HtmlPublic.php at line 119
        XenForo_ViewRenderer_HtmlPublic->renderContainer() in XenForo/FrontController.php at line 565
        XenForo_FrontController->renderView() in XenForo/FrontController.php at line 156
        XenForo_FrontController->run() in C:/xampp/htdocs/xen/index.php at line 13
    
    is the way I use in the code is wrong ....
     
  2. Mike

    Mike XenForo Developer Staff Member

    Your event listener isn't specified correctly. I think you might've messed up the case of the class name (lowercase "t").
     
  3. DroidHost

    DroidHost Well-Known Member

    it is working now .... :)
    I forget to add static > public static function
     
  4. DroidHost

    DroidHost Well-Known Member

    I do want to read the template HTML code ... is this the way to do it ?
     
  5. DroidHost

    DroidHost Well-Known Member

    I think I got it to work now ... thanks ...
     
  6. ragtek

    ragtek Guest

    the method needs to be static!

    edit:ups too slow^^
     

Share This Page