J3.x

Het gebruik van JHtmlTabs class in een component

From Joomla! Documentation

This page is a translated version of the page J3.x:Using the JHtmlTabs class in a component and the translation is 100% complete.
Other languages:
Deutsch • ‎English • ‎Nederlands • ‎español • ‎français
Joomla! 
≥ 3.0
versies

Overzicht

JHtmlTabs heeft 3 statische methoden die gebruikt kunnen worden om menu's met tabbladen te maken. Alle functies geven strings terug.

Opties voor JHtmlTabs

Dit zijn de opties die aan de JHtmlTabs::start() doorgegeven kunnen worden in de vorm van een array.

onActive: een callback functie wanneer een tab wordt geactiveerd met twee parameters.'title' is de tab zelf en 'description' is de inhoud van de tab.

onBackground: een callback functie wanneer een tab in de achtergrond wordt geplaatst.

startOffset: De standaard tab om mee te starten.

useCookie: Wel of niet gebruik maken van cookies om de active tab op te slaan (boolean)(true | false) // Dit is niet een string. Gebruik geen aanhalingstekens.

Voorbeeld

$options = array(
    'onActive' => 'function(title, description){
        description.setStyle("display", "block");
        title.addClass("open").removeClass("closed");
    }',
    'onBackground' => 'function(title, description){
        description.setStyle("display", "none");
        title.addClass("closed").removeClass("open");
    }',
    'startOffset' => 0,  // 0 starts on the first tab, 1 starts the second, etc...
    'useCookie' => true, // this must not be a string. Don't use quotes.
);

//Note that the options argument is optional so JHtmlTabs::start() can be called without it

echo JHtmlTabs::start('tabs_id',$options);
echo JHtmlTabs::panel("Panel Title 1",'panel-id-1');
    echo "<h2>Content of first panel goes here!</h2>";
    echo "<p>You can use JLayouHelper to render a layout if you want to</p>";
echo JHtmlTabs::panel(JText::_('CUSTOM_PANEL_TITLE'),'panel-id-2'); //You can use any custom text
    echo "<h2>Content of second panel goes here!<h2>";
echo JHtmlTabs::end();