[TYPO3-dev] stdWrap for all TLO's

Steffen Kamper steffen at sk-typo3.de
Wed Feb 13 23:56:15 CET 2008


Hi Olly,

"Oliver Hader" <oh at inpublica.de> schrieb im Newsbeitrag 
news:mailman.1.1202937815.21836.typo3-dev at lists.netfielders.de...
> Hi Steffen,
>
> Steffen Kamper schrieb:
>> "Martin Kutschker" <martin.kutschker-n0spam at no5pam-blackbox.net> schrieb 
>> im Newsbeitrag 
>> news:mailman.1.1202933890.7254.typo3-dev at lists.netfielders.de...
>>> Steffen Kamper schrieb:
>>>> Hi,
>>>>
>>>> i really miss stdWrap for some TLOs (Top Level Objects) like plugin. as 
>>>> COA, CONTENT etc already have.
>>> "plugin" is an array of USER and USER_INT objects. It's up to them to 
>>> provide stdWrap's for their properties.
>>>
>>> Masi
>>
>> Hi Masi,
>>
>> can you explain this with tt_news as example?
>> so normally it's an USER-Object. How can i provide stdWrap to that 
>> USER-Object?
>
> There is no out-of-the box way to use stdWrap (as you initially wrote in 
> your post to this thread). Developers just call $this->cObj->stdWrap from 
> their plugin, e.g.
>
> In TypoScript:
> plugin.tx_myext_pi1 = USER
> plugin.tx_myext_pi1 {
>   userFunc = tx_myext_pi1->main
>   stdWrap {
>     ...
>   }
> }
>
> In PHP class:
> function main($content, $conf) {
>   $content = $this->generateMyContent();
>   if (isset($conf['stdWrap.'])) {
>     $content = $this->cObj->stdWrap(
>       $content,
>       $conf['stdWrap.']
>     );
>   }
>   return $content;
> }
>
>
> There are also some extension which "group" their stdWraps in TypoScript, 
> like this as an example:
>
> stdWrap {
>   forListView {
>     wrap = <div class="list">|</div>
>     ...
>   }
>   forSingleView {
>     wrap = <div class="single">|</div>
>     ...
>   }
>   forWhatever {
>     ...
>   }
> }
>
> So, the data in $conf['stdWrap.'] would be in this case no valid stdWrap 
> as documented in TSref. But each sub-key would be this. Having this in 
> mind, means that adding the real stdWrap for USER/USER_INT might break a 
> lot of extensions which might have to change most of their PHP code.
>

thx for your examples and explanation.
>From programmers view using stdWrap is easy as you are free to define some 
in TS.
I see this from point of User making a TS for a page and try to use the 
"logical" way

- show Content (eg plugin.tt_news)
- if Content is empty show diffferent content

this is only possible using stdWrap with if statements, as i showed in 
initial post.
I know "plugin" is only a synonym for USER or USER_INT, so for core it 
should be simple to render the content with stdWrap.

Of coarse everything can be wrapped with COA to achieve the same effect and 
i don't know what's better solution:
using more TS-code or render plugin with stdWrap


> Another possibility would be to create a new TS object, e.g. "PLUGIN" 
> which has the real stdWrap implemented like in COA:
> plugin.tt_news = PLUGIN
> plugin.tt_news {
>   userFunc = tt_news->main
>   stdWrap.wrap = <div>|</div>
> }
>

nice, but where do you say here if it's USER or USER_INT ?

vg  Steffen 






More information about the TYPO3-dev mailing list