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

New contens on tab

Discussion in 'XenForo Development Discussions' started by gaga, Dec 23, 2015.

  1. gaga

    gaga New Member

    Hi to all,
    I need help to separate content on two tabs.

    This is my structure.
    New tab on navigation Custom Tab - this work great
    When click on Custom tab open new page with url: index.php?tralala
    In this page i need content in 2 tabs.
    This is template custom_tab:

        <ul class="tabs Tabs" data-panes="#CustomPanes > li">
            <li class="active"><a href="{$requestPaths.requestUri}#1">TAb 1</a></li>
            <li><a href="{$requestPaths.requestUri}#2">TAb 2}</a></li>
        <ul id="CustomPanes">
            <li><xen:include template="tab_1_content" /></li>
            <li><xen:include template="tab_1_content" /></li>
    Tab1 show content, but i dont know how to show content for tab 2 if click on Tab 2

    This is code of my ControllerPublic:

    class TestAddon_ControllerPublic_Tab extends XenForo_ControllerPublic_Abstract
        public function 
    $options XenForo_Application::get('options');

    $TabModel XenForo_Model::Create('XenForo_Model_Post');
    $Tabs $postModel->getTabContent($visitor$options->optionLimit);
    $viewParams = array(
    'tabs' => $Tabs

    How to add content for Tab#2 in this?

    Thank you,
    If you want more information please write on thread.
  2. gaga

    gaga New Member

    btw If i try to use different function for two tabs, ex. actionTab1 and actionTab2 i gives error
    The controller TestAddon_ControllerPublic_Tab does not define an action called Index.
  3. Robust

    Robust Well-Known Member

    'tabs' are done by the design in the template. At the end of the day, the same data is passed to the controller. What you can do is have a tab have a data attribute to load a controller URL, in which case create a new action in the controller and add the data attribute and use the template to style it (the template set the responseView of that controller). Another option is add tab2 to the same viewParams, and the tabs separate the data.

    For the sake of avoiding unnecessary queries/work when not needed, best to use the data attribute. See how it's done on the member controller with the tabs (e.g. posting, recent activity, tabs).

    Here's an (old, but still working) tutorial on doing it: https://xenforo.com/community/resou...-insert-tabs-in-profile-page-using-hooks.335/

    Obviously, use the template modification system and not template hooks.

Share This Page