Zum Inhalt springen

Extension photo_gals um den rtehtmlarea erweitern

Erstellt am 10. August 2008 · 5 Antworten · letzte Antwort am 15. September 2008

Tags: TCA, Frage

swingtra ·

Hallo,
Diese einfache Bildergallerie soll noch ne Beschreibung bekommen, hierzu wird der rtehtmlarea benötigt, das möchte ich erweitern.

Ich möchte einfach im Backend erstmal den rtehtmlarea eingeblendet bekommen. Jene Extension taucht als neues Ctype im Backend auf, ist also kein Datensatz vom Listmodul

wie bekomme ich den rtehtmlarea angezeigt, ein bodytext-Feld geht im Backend.
Hier der Code:

<?php
if (!defined ("TYPO3_MODE")) 	die ("Access denied.");

// erweitert geht mit bodytext
t3lib_div::loadTCA("tt_content");
$TCA["tt_content"]["types"][$_EXTKEY."_pi1"]["showitem"]="CType;;4;button;1-1-1, header;;3;;2-2-2, ;;3;;3-3-3,image;;;;4-4-4,bodytext;;3;;3-3-3, ;;;richtext[*];;;5-5-5";

//geht nicht, keine Anzeige mit Rte
//$TCA["tt_content"]["types"][$_EXTKEY."_pi1"]["showitem"]="CType;;4;button;1-1-1, header;;3;;2-2-2, bodytext;;3;;3-3-3,image;;;;4-4-4;;;, ;;;richtext[cut|copy|paste|formatblock|textcolor|bold|italic|underline|left|center|right|orderedlist|
//unorderedlist|outdent|indent|link|table|image|line|chMode]:rte_transform[mode=ts_css|
//];;;5-5-5";

//geht auch nicht, keine Anzeige mit RTE
//$TCA["tt_content"]["types"][$_EXTKEY."_pi1"]["showitem"]="CType;;4;button;1-1-1, header;;3;;2-2-2, bodytext;;3;;3-3-3,image;;;;4-4-4;;;, ;;;richtext[cut|copy|paste|formatblock|textcolor|bold|italic|underline|left|center|right|orderedlist|
//unorderedlist|outdent|indent|link|table|image|line|chMode]:rte_transform[mode=ts_css|
//imgpath=uploads/tx_mininews/rte/];;;5-5-5";




$TCA['tt_content']['ctrl']['typeicons']['photo_gals_pi1'] = t3lib_extMgm::extRelPath($_EXTKEY).'ext_icon.gif';



t3lib_extMgm::addPlugin(Array("LLL:EXT:photo_gals/locallang_db.php:tt_content.CType_pi1", $_EXTKEY."_pi1"),"CType");
?>
swingtra ·

... bin jetzt ein bisschen weiter
zumindest das Backen ist mit rte usw.

Hab die Info aus "Admin-Werkzeuge" dann "Konfiguration" dann "$TCA (tables.php)" das Drop-down und habe in meinem Fall mal die showlist von Ctype "text" angeschaut und angepasst

Soweit ganz schnuckelig:

hier aus der ext_tables.php

<?php
if (!defined ("TYPO3_MODE")) 	die ("Access denied.");


t3lib_div::loadTCA("tt_content,$tempColumns,1");
//alt,  9-10.8.2008
//$TCA["tt_content"]["types"][$_EXTKEY."_pi1"]["showitem"]="CType;;4;button;1-1-1, header;;3;;2-2-2, bodytext;;3;;3-3-3, image;;;;4-4-4";

//image;;2;;3-3-3, Neu,  10.8.2008
$TCA['tt_content']['types'][$_EXTKEY."_pi1"]['showitem'] = 'CType;;4;button,hidden,1-1-1, header;;3;;2-2-2,linkToTop;;;;3-3-3,--div--;LLL:EXT:cms/locallang_ttc.xml:CType.I.1, bodytext;;9;richtext:rte_transform[flag=rte_enabled|mode=ts_css];3-3-3;;;,image;;;2-2-2, rte_enabled, text_properties,--div--;LLL:EXT:cms/locallang_tca.xml:pages.tabs.access, starttime, endtime, module_sys_dmail_category;;;;1-1-1, richtext[*]';




//t3lib_extMgm::addTCAcolumns("tt_content",$tempColumns,1);
//t3lib_extMgm::addToAllTCAtypes ("tt_content","richtext[*]"); 


$TCA['tt_content']['ctrl']['typeicons']['photo_gals_pi1'] = t3lib_extMgm::extRelPath($_EXTKEY).'ext_icon.gif';


		
		

t3lib_extMgm::addPlugin(Array("LLL:EXT:photo_gals/locallang_db.php:tt_content.CType_pi1", $_EXTKEY."_pi1"),"CType");
?>

... das war schon ok.

jetzt muss ich in der pi1/class.tx_photogals_pi1.php noch den rte-Content zusehen bekommen

... aber ich bekomme den ganzen Content angezeit und ich bekomme die Abfrage nicht hin, damit nur der Content von der aktuellen Seite angezeigt wird.

#angry# vielleicht weis jemand Rat, bei der Abfrage stimmt was nicht, hier:

<?php
/***************************************************************
*  Copyright notice
*
*  (c) 2004 Roland Obermayer (roland@robelix.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!
***************************************************************/
/**
* Plugin 'Simple Photo Gallery' for the 'photo_gals' extension.
*
* @author Patrick Kapar <info@patie.nl>
*/
require_once(PATH_tslib.'class.tslib_pibase.php');


class tx_photogals_pi1 extends tslib_pibase {
	var $prefixId = 'tx_photogals_pi1';
	// Same as class name
	var $scriptRelPath = 'pi1/class.tx_photogals_pi1.php'; // Path to this script relative to the extension dir.
	var $extKey = 'photo_gals'; // The extension key.
	
	function main($content, $conf) {
	

	t3lib_div::makeInstance('tslib_cObj');
	//$this->id=$GLOBALS['TSFE']->id;
	//this->pi_getPageLink($GLOBALS["TSFE"]->id;
	
		$this->conf = $conf;
		$images = explode(',', $this->cObj->data['image']);
		$bigimg = '';
		$thumbs = '';
		if (t3lib_div::GPvar('tx_photogals_image') != '' && is_numeric(t3lib_div::GPvar('tx_photogals_image')) && (count($images) - 1) >= t3lib_div::GPvar('tx_photogals_image') && t3lib_div::GPvar('tx_photogals_elementid') == $this->cObj->data['uid']) {
			$uid = t3lib_div::GPvar('tx_photogals_image');
		}
		else {
			$uid = 0;
		}
		$bigimg = $this->mkBigImg($images[$uid]);
		$i = 0;
		foreach ($images as $img) {
			$thumbs .= '<div class="'.(t3lib_div::GPvar('tx_photogals_image') == $i ? 'tx-photogals-pi1-small-active' : 'tx-photogals-pi1-small').'">'.$this->pi_linkTP($this->mkThumbs($img, $i), array('tx_photogals_elementid' => $this->cObj->data['uid'], 'tx_photogals_image' => $i)).'</div>';
			$i++;
		}
		
		
		
		
		/**
	* erweitert um ein Inhaltelement, 10.08.2008
	*
	*/
	//
		// Datenbankabfrage (Felder, Tabelle, WHERE, GROUPBY, ORDERBY)
    	$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
			'*', //select
			'tt_content', // from
			'1'.$this->cObj->data['tt_content'],
			//'1'.$this->cObj->enableFields['tt_content'],//where
			//'', //$groupBy,
			'bodytext', //$orderBy,
			'sorting'//$limit
			);
			
			
    // Alle Titel zeilenweise aneinanderreihen
		while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
			$content .= $row['bodytext'] .  '<br />';
		}

    // Ausgabe wird von einem <div> der Klasse umschlossen
		$content .= $bigimg .$res . $thumbs ;
		return $this->pi_wrapInBaseClass($content);
	}
	
	
		
	
	/**
	* [Describe function...]
	*
	* @param	[type]		$img: ...
	* @return	[type]		...
	*/
	function mkBigImg($img) {
		$imgconf = $this->conf['image.'];
		$imgconf['params'] .= 'name="tx_photogals_big_'.$this->cObj->data['uid'].'" ';
		$imgconf['file'] = 'uploads/pics/'.$img;
		return $this->cObj->IMAGE($imgconf);
	}
	/**
	* [Describe function...]
	*
	* @param	[type]		$img: ...
	* @param	[type]		$i: ...
	* @return	[type]		...
	*/
	function mkThumbs($img, $i) {
		$imgconf = $this->conf['thumb.'];
		$imgconf['file'] = 'uploads/pics/'.$img;
		
		//Heiko , wichtig
		return $this->cObj->IMAGE($imgconf);
	}
}
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/photo_gals/pi1/class.tx_photogals_pi1.php']) {
	include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/photo_gals/pi1/class.tx_photogals_pi1.php']);
}
?>
swingtra ·

... Also wenn ich das so im Typo3 - SQL hinbekomme dann ist die Sache gebacken.

SELECT *
FROM `tt_content`
WHERE pid = 5
AND uid
swingtra ·

... also ich scheine mir die Antworten hier selber zu geben... 😃 (nein nicht ganz war)

Die Typo3 - API hat geholfen und das Forum.

unter Bezugsquelle und Hilfe von steffenk -> Danke steffenk !

... UID='.intval($this->cObj->data['uid'])

😃 unter:
#49684

konnte ich die doppelte Daten-Redundanz abstellen "doppelter Datensatz"

Lösung:

/**
	* erweitert um ein Inhaltelement, 10-11.08.2008
	* Datenbankabfrage (Felder, Tabelle, WHERE, GROUPBY, ORDERBY)
	*/
	
    	    $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
			'*', //select
			'tt_content', // from
			$this->cObj->enableFields['tt_content'].'pid='.intval($GLOBALS['TSFE']->id).' AND UID='.intval($this->cObj->data['uid']), //Where...
			'', //$groupBy,
			'sorting', //$orderBy,
			''//$limit
			);
Eazy ·

moin swingtra, hast du das hinbekommen? wäre interessiert...poste oder schick doch mal die tx3 datei...!

danke!