Zum Inhalt springen

nivoslider Typo3 6.10

Erstellt am 2. November 2013 · 1 Antwort · letzte Antwort am 2. November 2013

Tags: Dateien & FAL, Bilder, TYPO3 6.x, Frage

typo3_hp ·

Guten Morgen!

Ich habe damals (unter Typo 3.5) die Ext. nivoslider so umgebaut, dass die Bilder für den Slider aus dem Pagemedia gezogen werden und zwar so, dass erst auf der aktuellen Seite gesucht wird und sonst eine Ebene höher.

Dies funktioniert nun unter Typo3 6.x nicht mehr, da die Bilder in die Tabelle sysfiles gewandert ist.

Hat jemand eine Idee, was ich hier ändern muss, das es wieder geht?

das $page['media'] scheint ja so nicht mehr zu funktionieren.

Auszug:

	foreach($GLOBALS['TSFE']->rootLine as $page) {
		
  			if (!empty($page['media'])) {
   	 			$arrImages = t3lib_div::trimExplode(',', $page['media']);
    				if(count($arrImages)) break;
  			}
		}

Und hier noch komplett die Ext:

<?php
/***************************************************************
*  Copyright notice
*
*  (c) 2010 Tobias Liegl <tliegl@gmail.com>
*  All rights reserved
*
*  This script is part of the TYPO3 project. The TYPO3 project is
*  free software; you can redistribute it and/or modify
*  it under the terms of the GNU General Public License as published by
*  the Free Software Foundation; either version 2 of the License, or
*  (at your option) any later version.
*
*  The GNU General Public License can be found at
*  http://www.gnu.org/copyleft/gpl.html.
*
*  This script 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 General Public License for more details.
*
*  This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
 * [CLASS/FUNCTION INDEX of SCRIPT]
 *
 * Hint: use extdeveval to insert/update function index above.
 */

require_once(PATH_tslib.'class.tslib_pibase.php');


/**
 * Plugin 'Nivo Slider' for the 'nivoslider' extension.
 *
 * @author	Tobias Liegl <tliegl@gmail.com>
 * @package	TYPO3
 * @subpackage	tx_nivoslider
 */
class tx_nivoslider_pi1 extends tslib_pibase {
	var $prefixId      = 'tx_nivoslider_pi1';		// Same as class name
	var $scriptRelPath = 'pi1/class.tx_nivoslider_pi1.php';	// Path to this script relative to the extension dir.
	var $extKey        = 'nivoslider';	// The extension key.
	var $pi_checkCHash = true;
	var $uploadsDir	   = 'uploads/media/';
	
	/**
	 * The main method of the PlugIn
	 *
	 * @param	string		$content: The PlugIn content
	 * @param	array		$conf: The PlugIn configuration
	 * @return	The content that is displayed on the website
	 */
	public function main($content, $conf) {
		
		$this->conf = $conf;
		$this->pi_setPiVarDefaults();
		$this->pi_loadLL();
		
		// init variables
		$this->init();
		
		// generate images
		$images = $this->generateImages();
		
		// wrap images into the slider div
		$content = '<div id="slider' . $this->cObj->data['uid'] . '" class="nivoSlider">' . $images . '</div>';
		
		// add header parts to the page
		$this->addHeaderParts();

		// return the slider content
		return $content;

	}

	/**
	 * Initialize plugin variables
	 */
	protected function init() {
		
		$this->pi_initPIflexForm();

		$arrConf = array('general' => array('images', 'links', 'captions'),
						 'settings' => array('width', 'height', 'effect', 'slices', 'animspeed', 'pausetime', 'directionnav', 'directionnavhide', 'controlnav', 'pauseonhover', 'manualadvance', 'keyboardnav', 'captionopacity'));
		
		foreach ($arrConf as $sheetName => $arrParams) {
			foreach ($arrParams as $param) {
				$this->conf[$param] = $this->fetchConfigurationValue($param, $sheetName);
			}
		}

	}

	
	/**
	 * Add Header Parts
	 */
	protected function addHeaderParts() {
		
		$extPath = t3lib_extMgm::siteRelPath($this->extKey);
		
		// replace EXT: with the correct path to the extension
		$this->conf['cssFile'] = str_replace('EXT:', $extPath, $this->conf['cssFile']);
		$this->conf['jqueryFile'] = str_replace('EXT:', $extPath, $this->conf['jqueryFile']);
		$this->conf['nivosliderFile'] = str_replace('EXT:', $extPath, $this->conf['nivosliderFile']);

		// add header parts for the extension
		// standard key, so it gets only added once
		$headerParts = '';		
		if ($this->conf['cssFile'] != '') {
			$headerParts .= '<link rel="stylesheet" href="' . $this->conf['cssFile'] . '" type="text/css" media="screen" />';
		}
		if ($this->conf['jqueryFile'] != '') {
			$headerParts .= '<script src="' . $this->conf['jqueryFile'] . '" type="text/javascript"></script>';
		}	
		if ($this->conf['nivosliderFile'] != '') {
			$headerParts .= '<script src="' . $this->conf['nivosliderFile'] . '" type="text/javascript"></script>';
		}
		$GLOBALS['TSFE']->additionalHeaderData['EXT:' . $this->extKey] = $headerParts;
		
		// get the slider options
		$sliderOptions = $this->getSliderOptions();
		
		// add header parts
		// key is unique for each content element
		$headerParts2 = "<script type=\"text/javascript\">
		$(window).load(function() { $('#slider" . $this->cObj->data['uid'] . "').nivoSlider({ " . $sliderOptions . " }); });
		</script>";
		$GLOBALS['TSFE']->additionalHeaderData['EXT:' . $this->extKey . $this->cObj->data['uid']] = $headerParts2;
		
	}


	/**
	 * Get Slider Options
	 * Only adds options, if they are different from the default value
	 *
	 * @return	string Options
	 */
	protected function getSliderOptions() {
		
		$options = array();
		
		array_push($options, "effect:'" . $this->conf['effect'] . "'");

		if ( intval($this->conf['slices']) > 0) {
			array_push($options, 'slices:' . intval($this->conf['slices']));
		}

		if ( intval($this->conf['animspeed']) > 0) {
			array_push($options, 'animSpeed:' . intval($this->conf['animspeed']));
		}

		if ( intval($this->conf['pausetime']) > 0) {
			array_push($options, 'pauseTime:' . intval($this->conf['pausetime']));
		}
				
		if ($this->conf['directionnav'] == 0) {
			array_push($options, 'directionNav:false');
		}

		if ($this->conf['directionnavhide'] == 0) {
			array_push($options, 'directionNavHide:false');
		}

		if ($this->conf['controlnav'] == 0) {
			array_push($options, 'controlNav:false');
		}

		if ($this->conf['pauseonhover'] == 0) {
			array_push($options, 'pauseOnHover:false');
		}

		if ($this->conf['manualadvance'] == 1) {
			array_push($options, 'manualAdvance:true');
		}
		
		if ($this->conf['keyboardnav'] == 0) {
			array_push($options, 'keyboardNav:false');
		}
		
		if ( floatval($this->conf['captionopacity']) > 0 && $this->conf['captionopacity'] != 0.8) {
			array_push($options, 'captionOpacity:' . floatval($this->conf['captionopacity']));
		}
		
		return implode(',', $options);

	}

	/**
	 * Generate slider images
	 *
	 * @return	string Images
	 */
	protected function generateImages() {
		
		// Erweiterung 10.10.2012 / Bilder aus PageMedia Slide!
		foreach($GLOBALS['TSFE']->rootLine as $page) {
		
  			if (!empty($page['media'])) {
   	 			$arrImages = t3lib_div::trimExplode(',', $page['media']);
    				if(count($arrImages)) break;
  			}
		}
				
		

		$arrLinks = t3lib_div::trimExplode(chr(10), $this->conf['links']);
		$arrCaptions = t3lib_div::trimExplode(chr(10), $this->conf['captions']);
		
		$content = '';
		foreach ($arrImages as $key => $strFileName) {
			$imageConfig['file'] = $this->uploadsDir . $strFileName;
			$imageConfig['file.']['width'] = $this->conf['width'];
			$imageConfig['file.']['height'] = $this->conf['height'];
			$imageConfig['altText'] = $arrCaptions[$key];
			$imageConfig['titleText'] = $arrCaptions[$key];
			$imageConfig['stdWrap.']['typolink.']['parameter'] = $arrLinks[$key];
			$imageConfig['params'] = '';
			if ($key == 0) {
				$imageConfig['params'] = 'class="first"';
			}
			
			$image =  $this->cObj->IMAGE($imageConfig);
			
			$content .= $image;
			
		}
		
		return $content;
		
	}


	/**
	 * Fetches configuration value given its name.
	 * Merges flexform and TS configuration values.
	 *
	 * @param	string $paramName Configuration value name
	 * @param	string $sheetName Flexform sheet name
	 * @return	string Parameter value
	 */
	protected function fetchConfigurationValue($paramName, $sheetName) {
		$value = trim($this->pi_getFFvalue($this->cObj->data['pi_flexform'], $paramName, $sheetName));
		return $value ? $value : $this->conf[$paramName];
	}

	
}


if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/nivoslider/pi1/class.tx_nivoslider_pi1.php'])	{
	include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/nivoslider/pi1/class.tx_nivoslider_pi1.php']);
}

?>

Vielen Dank und Grüße

typo3_hp ·

Niemand eine Idee?

Ich finde den Zusammenhang zwischen dem Eintrag in der SYS_FILE Tabelle (für das in den Seiteneigenschaften zugewiesene Bild) und der Seite nicht.?

Danke und Grüße