[TYPO3-english] Render textpic in extension

Jigal van Hemert jigal at xs4all.nl
Tue Aug 16 10:53:00 CEST 2011


Hi,

On 16-8-2011 9:55, Tomas Havner wrote:
> I'm trying to render a textpic-element in my extension. What I got so
> far is:
>
> $TS['conf'] = 'IMGTEXT';
> $TS['conf.']['text.']['10'] = 'TEXT';
> $TS['conf.']['text.']['10.']['value'] = $bodytext;
> $TS['conf.']['textPos'] = 17;
> $TS['conf.']['imgList'] = $imgList;

You can actually call IMGTEXT directly from your extension. I'd use:

$imageTextConfiguration = array();
$imageTextConfiguration['text.']['10'] = 'TEXT';
$imageTextConfiguration['text.']['10.']['value'] = $bodytext;
$imageTextConfiguration['textPos'] = 17;
$imageTextConfiguration['imgList'] = $imgList;

> $myCObj = new tslib_cObj();

Use t3lib_div::makeInstance() to create new objects and not the 
new-operator.
Besides, if you are making a pi_base extension (i.e. not using Extbase) 
then there is already an instance available:

$this->cObj

> $content = $myCObj->cObjGetSingle($TS['conf'],$TS['conf.']);

As said earlier, you can directly call IMGTEXT:

$content = $this->cObj->IMGTEXT($imageTextConfiguration);

Note: is your configuration really complete? See example in [1]. Test it 
first in Typoscript (with a list of images from a directory) and use the 
working configuration in your extension...

[1] http://goo.gl/ODsMV (TSref documentation)

-- 
Kind regards / met vriendelijke groet,

Jigal van Hemert.


More information about the TYPO3-english mailing list