[TYPO3-english] Render textpic in extension
Urs Bräm
info at ursbraem.ch
Wed Aug 17 13:05:19 CEST 2011
Hi Tomas
>> On 16-8-2011 9:55, Tomas Havner wrote:
>>> I'm trying to render a textpic-element in my extension.
This is out of the box, as it's on a TS level, but if everything fails,
you could also render the Textpic as a content object with TS only:
http://www.typo3wizard.com/en/articles/explaining-the-content-object.html
Urs
>>>
>>> $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)
>>
> Thank you!
>
> When I added $imageTextConfiguration['imgPath'] = 'uploads/pics/'; the
> images showed. But wrapped in tables :( It seems as IMGTEXT is not what
> I was looking for. Found:
>
> $TS['conf'] = ' < tt_content.textpic.20';
> $TS['conf.']['text.']['20'] = 'TEXT ';
> $TS['conf.']['text.']['20.']['value'] = $row['bodytext'];
> $TS['conf.']['imgList'] = $imgList;
> $TS['conf.']['imgList.'] = ' >';
> $TS['conf.']['layout.']['key'] = 17;
> $TS['conf.']['layout.']['key.'] = ' >';
>
> in an old post, but it didn't work. Any thoughts?
>
> Tomas
--
Urs Bräm
macht Websites
---
Certified Typo3 Integrator
CH-3011 Bern
www.ursbraem.ch
More information about the TYPO3-english
mailing list