Halöchen,
ich möchte ein userElement im RTE anlegen. Das klappt alles wunderbar, als mode benutze ich procesoor, und als submitToScript eine Angabe zu einer PHP-Datei.
3 = In Großbuchstaben umwandeln
3.description = Markierter Text wird in GB umgewandelt.
3.mode = processor
3.submitToScript = fileadmin/toUpper.php
<?php
echo strtoupper($_POST['processContent']);
?>
So wird das jetzt in Großbuchstaben umgewandelt, doch wie schließe ich das Popup und vor allen Dingen wie kommt der Code aus der PHP-Datei wieder in den RTE!?!
LG
herbie
Beim htmlArea, den du wahrscheinlich benutzt,
fehlt das Beispielscript rte_cleaner.php.
Daraus geht hervor, wie man die Daten wieder zurück bekommt:
<?php
/***************************************************************
* Copyright notice
*
* (c) 1999-2004 Kasper Skaarhoj (kasperYYYY@typo3.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.
* A copy is found in the textfile GPL.txt and important notices to the license
* from the author is found in LICENSE.txt distributed with these scripts.
*
*
* 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!
***************************************************************/
/**
* EXAMPLE SCRIPT! Simply strips HTML of content from RTE
*
* @author Kasper Skaarhoj <kasperYYYY@typo3.com>
*/
/**
* [CLASS/FUNCTION INDEX of SCRIPT]
*
*
*
* 66: class SC_rte_cleaner
* 74: function init()
* 102: function main()
* 122: function printContent()
*
* TOTAL FUNCTIONS: 3
* (This index is automatically created/updated by the extension "extdeveval")
*
*/
unset($MCONF);
require ('conf.php');
require ($BACK_PATH.'init.php');
require ($BACK_PATH.'template.php');
/**
* Script Class
*
* @author Kasper Skaarhoj <kasperYYYY@typo3.com>
* @package TYPO3
* @subpackage tx_rte
*/
class SC_rte_cleaner {
var $content;
var $siteURL;
var $doc;
/**
* Initialize.
*
* @return void
*/
function init() {
global $BACK_PATH;
$this->siteURL = substr(t3lib_div::getIndpEnv('TYPO3_SITE_URL'),0,-1);
$this->doc = t3lib_div::makeInstance('template');
$this->doc->backPath = $BACK_PATH;
$this->doc->form = '';
$this->doc->JScode=$this->doc->wrapScriptTags('
var RTEobj = self.parent.parent;
function setSelectedTextContent(content) { //
var oSel = RTEobj.GLOBAL_SEL;
var sType = oSel.type;
if (sType=="Text") {
oSel.pasteHTML(content);
}
}
');
}
/**
* Create main content (JavaScript section).
*
* @return void
*/
function main() {
$this->content='';
$this->content.=$this->doc->startPage('RTE cleaner');
$this->content.=$this->doc->wrapScriptTags('
setSelectedTextContent(unescape("'.rawurlencode(strip_tags(t3lib_div::_GP("processContent"))).'"));
RTEobj.edHidePopup();
');
}
/**
* Print content
*
* @return void
*/
function printContent() {
$this->content.= $this->doc->endPage();
echo $this->content;
}
}
// Include extension?
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rte/app/rte_cleaner.php']) {
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rte/app/rte_cleaner.php']);
}
// Make instance:
$SOBE = t3lib_div::makeInstance('SC_rte_cleaner');
$SOBE->init();
$SOBE->main();
$SOBE->printContent();
?>
Dein Code gehört also in Zeile 103.
hm, alles klar, sind die Dateien conf.php und so aus dem RTE-Ordner, oder wo liegen die?
Es scheint zu diesen Problem leider kein wirklich schönes Beispiel zu geben.
Dieses hier funktioniert in TYPO3 6.1 wohl nicht mehr.
Ich habe dieses Bespiel ein wenig abgeändert damit es bei mir läuft.
Mein Ziel war es Soundcloud embedded iframes aus der Soundcloud URL zu generieren.
Meine Lösung zu diesen Thema ist hier zu finden:
http://www.johnnysnow.com/rte-userelements-im-mode-processor/
Sollte es ein schöneres Beispiel geben was irgendwie eleganter an die RTEarea[editorNo] kommt, wäre ich für einen Hinweis dankbar.