ok, vergessen wir den Alpha-Effekt, aber kann mir bitte jemand zumindest bei dem Hinzufügen einer "first" und "last"-Klasse (oder irgendein anderer Name, um das erste und letzte Menü-Element per CSS anzusprechen) bei den Menü LIs helfen?
So wird der Code im FE generiert:
Code:
<div class="ce_tabcontrol_tabs block">
<ul>
<li class="tabs selected">Punkt 1</li>
<li class="tabs ">Punkt 2</li>
<li class="tabs ">Punkt 3</li>
</ul>
</div>
Wahrscheinlich müsste man dieses Template anpassen... aber wie?
PHP-Code:
<?php if (!defined('TL_ROOT')) die('You can not access this file directly!');
/**
* TYPOlight webCMS
* Copyright (C) 2005 Leo Feyer
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 2.1 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, please visit the Free
* Software Foundation website at http://www.gnu.org/licenses/.
*
* PHP version 5
* @copyright Jean-Bernard Valentaten 2009
* @author Jean-Bernard Valentaten <troggy.brains@gmx.de>
* @package TabControl
* @license GNU/LGPL
* @filesource
*/
/**
* Class ContentTabControl
*
* @copyright Jean-Bernard Valentaten 2009
* @author Jean-Bernard Valentaten <troggy.brains@gmx.de>
* @package Controller
*/
class ContentTabControl extends ContentElement {
/*
* Datamember
*/
/**
* Contains the default classes used in our
* tab-template
*
* @staticvar array
* @access private
*/
private static $defaultClasses = array('tabs', 'panes');
/**
* Contains the path to the js-plugin needed for Tabcontrols to work
*
* @var string
* @access private
*/
private $strPlugin = 'plugins/tabcontrol/tabcontrol.js';
/**
* The template
*
* @var string
* @access protected
*/
protected $strTemplate = 'ce_tabcontrol_tab';
/*
* Methods
*/
/**
* Generate content element
*/
protected function compile() {
//init vars
$classes = deserialize($this->tabClasses); //come all ye classes ;)
$titles = deserialize($this->tabTitles); //will only be filled when in tab-mode
static $panelIndex = 0; //static index counter
//default classes if neccessary
if (!count($classes)) {
$classes = self::$defaultClasses;
} else {
if (!strlen($classes[0])) $classes[0] = self::$defaultClasses[0];
if (!strlen($classes[1])) $classes[1] = self::$defaultClasses[1];
}
//take some measures depending on the selected tab type
switch ($this->tabType) {
case 'tabcontrolstart':
//start a new panel
if (TL_MODE=='FE') {
$this->strTemplate = 'ce_tabcontrol_start';
$this->Template = new FrontendTemplate($this->strTemplate);
} else {
$this->strTemplate = 'be_wildcard';
$this->Template = new BackendTemplate($this->strTemplate);
$this->Template->wildcard = '### TabControl: '.(++$panelIndex).'. Pane START ###';
}
break;
case 'tabcontrolstop':
//stop the current panel
if (TL_MODE=='FE') {
$this->strTemplate = 'ce_tabcontrol_stop';
$this->Template = new FrontendTemplate($this->strTemplate);
} else {
$this->strTemplate = 'be_wildcard';
$this->Template = new BackendTemplate($this->strTemplate);
$this->Template->wildcard = '### TabControl: '.$panelIndex.'. Pane END ###';
}
break;
case 'tabcontroltab':
default:
//display some tabs and check whether we need to append our plugin
if (TL_MODE=='FE') {
//make sure our plugin will be loaded
if (!is_array($GLOBALS['TL_JAVASCRIPT'])) {
$GLOBALS['TL_JAVASCRIPT'] = array($this->strPlugin);
} elseif (!in_array($this->strPlugin, $GLOBALS['TL_JAVASCRIPT'])) {
$GLOBALS['TL_JAVASCRIPT'][] = $this->strPlugin;
}
//finally, we set template
$this->Template = new FrontendTemplate($this->strTemplate);
} else {
$titleList = '';
foreach($titles as $index=>$title) {
$titleList .= ++$index.'. '.$title.'<br/>';
}
$this->strTemplate = 'be_wildcard';
$this->Template = new BackendTemplate($this->strTemplate);
$this->Template->wildcard = '### TabControl: Tabs ###';
$this->Template->title = $titleList;
}
}
//and pass it all to the template
$this->Template->behaviour = $this->tabBehaviour;
$this->Template->panes = $classes[1];
$this->Template->panesSelector = '.'.str_replace(' ', '.', $classes[1]);
$this->Template->tabs = $classes[0];
$this->Template->tabsSelector = '.'.str_replace(' ', '.', $classes[0]);
$this->Template->titles = $titles;
}
}
?>
Lesezeichen