New contens on tab

gaga

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

Soo...
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:

Code:
    <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>
   
    <ul id="CustomPanes">
        <li><xen:include template="tab_1_content" /></li>
        <li><xen:include template="tab_1_content" /></li>

    </ul>

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:

PHP:
class TestAddon_ControllerPublic_Tab extends XenForo_ControllerPublic_Abstract
{
    public function actionIndex()
    {
 
        $options = XenForo_Application::get('options');

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

        );
        return $this->responseView('TestAddon_ViewPublic_Tab', 'custom_tab', $viewParams);
    }

How to add content for Tab#2 in this?

Thank you,
If you want more information please write on thread.
 
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.
 
'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.
 
Top Bottom