1. 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?

Discussion in 'XenForo Development Discussions' started by Marcus, Aug 21, 2013.

  1. Marcus

    Marcus Well-Known Member

    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 &$containerDataXenForo_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: Aug 21, 2013
  2. Marcus

    Marcus Well-Known Member

    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?
     
  3. Jeremy

    Jeremy XenForo Moderator Staff Member

    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.
     
  4. Marcus

    Marcus Well-Known Member

    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.
     

Share This Page