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

Adding a sidebar just with Template Modification System possible?

Marcus

Well-known member
#1
Is there a way to add a sidebar with the Template Modification System (and I guess xen:callback)? Currently my solution listens to template_post_render with template hint forum_view and adds my_sidebar_forum_view template as sidebar
PHP:
class My_TemplatePostRender_ForumView
{
   public static function renderSidebar($templateName, &$content, array &$containerData, XenForo_Template_Abstract $template)
   {
     $containerData['noVisitorPanel'] = true;
     $sidebarTemplate = 'my_sidebar_' . $templateName;
     $output = $template->create($sidebarTemplate, $template->getParams());
     empty($containerData['sidebar']) ? $containerData['sidebar'] = $output : $containerData['sidebar'] .= $output;
   }
}
 
Last edited:

Marcus

Well-known member
#2
It looks to be solved by simple template modification.
PHP:
<xen:sidebar>
   <xen:edithint template="sidebar.css" />

   <xen:hook name="forum_view_sidebar">
   </xen:hook>
</xen:sidebar>
Is it allowed to add xen:hook on my own?
 

Jeremy

Well-known member
#3
Yes, you can add-on your own hooks, but since they are deprecated they won't be added officially and may stop working in future versions.
 

Marcus

Well-known member
#4
Good to know hooks won't be around forever. What's the best anchor for further TMS modifications? xen:comment?

My idea is to have one addon that adds sidebars to forum_view and thread_view. And then other addons will use the anchor (currently the hook) to display their templates there.