[TYPO3-dev] rendering a modified tt_content record inside of plugin

Steffen Kamper info at sk-typo3.de
Tue Mar 31 19:17:37 CEST 2009


Hi Bernd,

bernd wilke schrieb:
> On Tue, 31 Mar 2009 18:26:58 +0200 Steffen Kamper wrote:
> 
>> Hi,
>>
>> bernd wilke schrieb:
>>> On Tue, 31 Mar 2009 16:37:52 +0300 Dmitry Dulepov wrote:
>>>
>>>> Hi!
>>>>
>>>> bernd wilke wrote:
>>> [...]
>>>>> Is there a possibility to build up a tt_content-record in memory and
>>>>> render it without creation of a real tt_content-record?
>>>> Yes, possible. CSS styled content does that by using 'tt_content' TS
>>>> object.
>>> can you give me a hint where I can find an usage or example?
>>>
>>> bernd
>> doesn't this work?
>>
>> 10 = RECORDS
>> 10.source.current = 1
>>
>> vg Steffen
> 
> I'm inside an extension plugin. it is a new contentelement so the type is 
> neither text/image nor plugin.
> As I have it configured it enables the same fields as of type image.
> So the TYPO3 rendering calls class.tx_myext_pi1.php and there I want to 
> render the fields of the current tt_content record ($this->cObj->data) as 
> if it is of type image. Before that I want to change some fields like 
> caption, width, ...
> If I would use $this->cObj->RECORDS(array('source.'=>array
> ('current'=>1))) it will end in a loop as this would call my plugin again 
> with the original record from the database instead of a modified version 
> in memory which I could provide.
> 
> I could build a fix TS-array, but I want my extension to use the std-
> typoscript-configuration which can be differnt on every installation. 
> (e.g. pmkslimbox modifies the rendering of images, or someone has defined 
> a special frame for images on his website)
> 
> 
> bernd
have a look at tslib_content::cObjGetSingle where you can add a 
user-object with hook:
$TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['cObjTypeAndClass']

Then create a TS for your new type like the other tt_content-entries.

That should work.

vg Steffen




More information about the TYPO3-dev mailing list