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

Unhappy couple: xen:callback and ControllerPublic::action

Marcus

Well-known member
#1
I have lots of ControllerPublic::action functions returning their results by template hook, all of which I now translate to xen:callback.

xen:callback does not like the action parameter, instead I can use return, get, view. When I use the get function and rename my action function to get, functionality as $this->_input->filterSingle gets lost.
PHP:
<xen:callback class="My_ControllerPublic_Forum" method="getIndex"></xen:callback>
PHP:
class My_ControllerPublic_Forum extends XenForo_ControllerPublic_Abstract
{
   public function getIndex()
   {
     $forumId = $this->_input->filterSingle('node_id', XenForo_Input::UINT);
  $myVar = $forumId*5; // for testing obviously
    $viewParams = array(
         'myVar' => $myVar ,
     );
     
     return $this->responseView(
         'My_ViewPublic_My',
         'my_sidebar_forum_list',
         $viewParams
     );
 

Marcus

Well-known member
#3
What do you mean by existing controllers? XenForo_ControllerPublic_Abstract is not fitting into this category?

What is the easiest and most convenient way to return a template like I try in my first post?
 

Marcus

Well-known member
#7
Just wondering, why are you avoiding extending Controllers at all costs? (This is the impression I am getting)
I am simply looking for a way to avoid template_post_render to add templates for my addons. This is slowing my test system down for 0.01 seconds, and it only merges my template with the sidebar template on forum_list:
PHP:
//template forum_list
     $sidebarTemplate = 'sidebar_forum_list;
     
     $output = $template->create($sidebarTemplate, $template->getParams());
       
     empty($containerData['sidebar']) ? $containerData['sidebar'] = $output : $containerData['sidebar'] .= $output;
 

tyteen4a03

Well-known member
#8
I am simply looking for a way to avoid template_post_render to add templates for my addons. This is slowing my test system down for 0.01 seconds, and it only merges my template with the sidebar template on forum_list:
PHP:
//template forum_list
     $sidebarTemplate = 'sidebar_forum_list;
   
     $output = $template->create($sidebarTemplate, $template->getParams());
     
     empty($containerData['sidebar']) ? $containerData['sidebar'] = $output : $containerData['sidebar'] .= $output;
You can't use forum_list as event hint?
 
Last edited:

Marcus

Well-known member
#9
You can't use PAGE_CONTAINER as event hint?
My addon which adds its sidebar template into the existing sidebar on forum_list works great. However I want to avoid adding templates on execution. I want the templates to be compiled within the system before execution. That's why I want to use the template modification system.
 
Last edited: