Some issues relating with dynamic editor templates

8 views
Skip to first unread message

Tapio

unread,
Nov 26, 2008, 6:11:59 AM11/26/08
to TYPO3 tinymce_rte
Hi

Sometimes might needed transformation from database to editor.
There is t3lib_parsehtml_proc::RTE_transform function, but the problem
is what level config array it needs.

http://doc-typo3.ameos.com/4.1.0/classt3lib__parsehtml__proc.html

t3lib_parsehtml_proc::RTE_transform ($value,$specConf,direction =
'rte',$thisConfig = array())

$thisConfig = Parsed TypoScript content configuring the RTE, probably
coming from Page TSconfig.

But what level - what is the actual config to feed?

class.tx_tinymce_rte_templates.php has:

$this->pageTSconfig = t3lib_BEfunc::getPagesTSconfig( $this->pageId );

if ( t3lib_div::_GP('mode') != 'FE' )
$this->conf = $this->pageTSconfig['RTE.']['default.'];
else
$this->conf = $this->pageTSconfig['RTE.']['default.']['FE.'];

but maybe '$this->pageTSconfig' and '$this->conf ' are not correct

Is

$rteConfig=$this->pageTSconfig['RTE.']; ?

or what?

$content.='<div>'.substr(t3lib_parsehtml_proc::RTE_transform
($contentRow['bodytext'],'','rte',$rteConfig),285).'</div>';

Peter Klein

unread,
Nov 26, 2008, 7:42:53 AM11/26/08
to typo3-ti...@googlegroups.com
Look at the source of class.t3lib_parsehtml_proc.php, and see what kind of
parameters it expects.


MvH
Peter Klein
__________________________

Umloud Untd
Vestergade 8
1456 København K

Tel. 3311 8887
Fax 3311 8884
__________________________
--
No virus found in this incoming message.
Checked by AVG.
Version: 7.5.549 / Virus Database: 270.9.10/1812 - Release Date: 25-11-2008
19:53


Tapio

unread,
Nov 26, 2008, 8:03:40 AM11/26/08
to TYPO3 tinymce_rte


On 26 marras, 14:42, "Peter Klein" <pe...@umloud.dk> wrote:
> Look at the source of class.t3lib_parsehtml_proc.php, and see what kind of
> parameters it expects.

maybe must look.
It is just annoying that
http://doc-typo3.ameos.com/4.1.0/classt3lib__parsehtml__proc.html

doesn't give enough information how to feed correct parameters.

Tapio

unread,
Nov 26, 2008, 11:41:42 AM11/26/08
to TYPO3 tinymce_rte


On 26 marras, 14:42, "Peter Klein" <pe...@umloud.dk> wrote:
> Look at the source of class.t3lib_parsehtml_proc.php, and see what kind of
> parameters it expects.

$this->procOptions = $thisConfig['proc.'];

so $this->conf is the correct variable

Tapio

unread,
Nov 26, 2008, 2:53:45 PM11/26/08
to TYPO3 tinymce_rte
I tried to add into RTE field also dynamic parts, which will handled
through TyposScript and user functions, when they would change, for
example

[myreplace] inside RTE content - put normally or through editor
template
TS Template something like this

includeLibs.hsme_string = fileadmin/ext-templates/user_myreplace.inc
tt_content.text.20 {
parseFunc {
userFunc.file.width=94
userFunc.file.height=94
userFunc.leftCell=28
userFunc=user_myreplace->user_myreplace
}
}
}

and PHP file
<?php
require_once ( PATH_site . 't3lib/class.t3lib_parsehtml_proc.php');
class user_myreplace { // extends tslib_pibase
var $cObj;
var $parser;
function user_myreplace($content="",$conf=array()) {
$this->cObj = t3lib_div::makeInstance('tslib_cObj');
$this->parser = t3lib_div::makeInstance('t3lib_parsehtml_proc');
...cut...

// modifying image file - OK
$imageFile=$this->cObj->cImage($imageFile,$conf);

...cut...

But parsing 'bodytext' field nice way - I get just with this extremely
ugly hack:

$idconf['table']='tt_content';
$idconf['select.']['selectFields']='bodytext,CType';
$idconf['select.']['where'] = 'uid='.intval($contentRow['uid']).'';
$idconf['select.']['pidInList']=$conf['leftCell'];
$idconf['wrap']='|';

static $counter=0; // test just once inside page rendering
// if you try to get $this->cObj->CONTENT($idconf) second time it
failes - must take inside if statement
if($res=$this->cObj->CONTENT($idconf)) {
$counter++;
if($counter==1) {
define('RESULT',$res); // save permamently - can't use static
variable for string value
}
$counter++;
}
$contentRow['bodytext']=RESULT; // creates content like normally but
doesn't suppor realURL or simulate static documents - works if content
fetched from other page than current page

I tried to use

#$rteConf['allowTags']='a, abbr, acronym, address, blockquote, b, br,
caption, cite, code, div, em,h1, h2, h3, h4, h5, h6, hr, i, img, li,
link, ol, p, pre, q, span, strong, sub, sup, table, tbody, td, th, tr,
tt, ul, object,embed,param,iframe';
#$contentRow['bodytext']=$this->parser->RTE_transform($contentRow
['bodytext'],array(),'rte',$rteConf);
#$contentRow['bodytext']=$this->cObj->HTMLparser_TSbridge($contentRow
['bodytext'], $conf);
#$contentRow['bodytext']=$this->parser->TS_transform_rte($contentRow
['bodytext']);

that could give possibility to use in editor templates:

* static HTML
* dynamic generated but converted as static HTML
* ful dynamic parts
Reply all
Reply to author
Forward
0 new messages