[TYPO3-ect] my first view on lib / div

Daniel Pötzinger operation-lan at gmx.de
Fri Sep 28 22:32:47 CEST 2007


Ernesto Baschny [cron IT] schrieb:
> Daniel Pötzinger wrote: on 28.09.2007 01:50:
>> BTW
>>
>> Where can I suggest functions for lib?
>>
>> e.g. a function like asImage() and printAsImage() would be nice in the
>> view classes.
>>
>> something like:
>> function asImage($name,$configuration) {
>>         $lConf=$this->configurator->get($configuration);
>>         if (is_array($lConf)) {   
>>             $lConf['file'] .= $this->get('name');       
>>             $cObject = $this->findCObject();       
>>             return $cObject->IMAGE($lConf);
>>         }
>> }
> 
> This is usually not very flexible (hardcoding the CType "IMAGE" in a
> function). I would always suggest:
> 
> Add the data you need for rendering the image (here the filename) to
> $cObj->data and then just render a cObject using cObjGetSingle. Maybe
> the data in your cObject already contains the image filename (and other
> data relevant to the row you are rendering), then you don't need to do
> anything in PHP.
> 
> This way the admin is free to make it a GIFBUILDER, a TEXT (e.g. for
> some plain-text version) or maybe even a COA with more stuff, etc.
> 
> But think about it, I would then call that method:
> 
> 	renderContentObject($configurationKey)
> 
> and you can then render any TypoScript cObject with the current model's
> data using a specific configurationKey, which might of course be an IMAGE.
> 
Well thanks but if I want to output a certain field in my view this 
field has to be interpreted in a certain way. For text this is HTML and 
for an Image it is IMAGE.
So I guess it fully fits into the concept of a view - and the name of 
the function is not asContentObject but it is asImage. And this is used 
in the template so if I dont want it as Image I put there asSomethingElse..

greetings


More information about the TYPO3-team-extension-coordination mailing list