[TYPO3-mvc] TypoScript manipulation per object property

Franz Koch typo3.RemoveForMessage at elements-net.de
Thu Jul 22 19:35:23 CEST 2010


Hi Thomas,

>> b) use proxy classes which will fetch and process the return values on
>> demand (the way I'd go)
>
> Yay, thanks for the hint - but unfortunately I can't figure out what you
> really mean about that.
>
> With proxy class you mean a proxy of the domain model?
>
> I'd appreciate it, if you could describe a bit more
> how and where this could be implemented. Maybe we can
> work out a general approach which could be used for
> Extbase if it makes any sense.

Don't know if proxy is the correct wording for it - maybe call it 
"wrapper" class. Basically you create a class/object with magic getters 
and assign your object/array to it as well as the basic TS path it 
should use to check for TS definitions. Then you assign this "wrapper" 
object to your view (maybe with a slight different naming). Now, use 
this object just like your other object in the template. If FLUID now 
tries to fetch the property from your "wrapper" object, your magic 
getter is fetching the property from the original object/array, 
processes it with stdWrap or whatever and returns the processed value to 
FLUID. In your "wrapper" class you could implement a cache, so that you 
don't have to process properties each time they get requested (f.e. 
first in a if-condition and then when rendered).

All this can/should be implemented in a custom viewHelper (+ 
proxy/wrapper class) and could be used like this in FLUID:
-------------------------------------------
<ul class="productList">
<f:for each="{products}" as="product">
   <li>
   <my:TypoScriptRenderer use="{product}" as="TSproduct" 
typoScriptPathSegment="plugin.tx_myext.settings.TSprocessing.product">
      {TSproduct.title}
      {TSproduct.subtitle}
      {TSproduct.description}
   </my:TypoScriptRenderer>
   </li>
</f:for>
</ul>

-------------------------------------------
TS:
-------------------------------------------
plugin.tx_myext.settings.TSprocessing.product {
   title {
     wrap = <h2>|</h2>
   }
   subtitle {
     required = 1
     wrap = <h3 class="subtitle">|</h3>
   }
   description {
     crop = 100|...|1
     parseFunc =< lib.parseFunc_RTE
   }
}



hope it's a bit clearer now what I meant.

-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list