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

Rendering Template in Static Function

Discussion in 'XenForo Development Discussions' started by Marcus, Nov 1, 2013.

  1. Marcus

    Marcus Well-Known Member

    PHP:
    public static function noticesPrepare (
      array &
    $noticeList,
      array &
    $noticeTokens,
      
    XenForo_Template_Abstract $template,
      array 
    $containerData
    )  {}
    I want to render the message in new created template notice_message. $this->responseview does not work as it is a static function and I am not in the controller anyway. This does not work as I do not know how to assign the result to a variable:

    PHP:
      $responseView= new XenForo_ControllerResponse_View();
      
    //$responseView->viewName = $viewName;
      
    $responseView->templateName 'post';
      
    //$responseView->params = array();
      //$responseView->containerParams = array();

    Maybe you have an idea how to solve that?
     
    Last edited: Nov 1, 2013
  2. Marcus

    Marcus Well-Known Member

    $template->view123 = $responseView;

    returns this

    PHP:
    ["view123"] => object(XenForo_ControllerResponse_View)#488 (9) {
    ["viewName"] => string(0""
    ["templateName"] => string(7"contact"
    ["params"] => array(0) {
    }
    [
    "containerParams"] => array(0) {
    }
    [
    "jsonParams"] => array(0) {
    }
    [
    "subView"] => NULL
    ["responseCode"] => int(200)
    [
    "controllerName"] => string(0""
    ["controllerAction"] => string(0""
    }
     

Share This Page