[TYPO3-mvc] TypoScript manipulation per object property
Helmut Hummel
helmut at typo3.org
Fri Jul 23 00:34:54 CEST 2010
Hi,
On 22.07.10 19:35, Franz Koch wrote:
>
> 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.
This pattern is known as "decorator pattern".
> 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).
What about having something like this:
$view->assign('myobject',$myobject,'Tx_Fluid_View_PropertyDecorator');
(Third parameter optional)
The decorator could then take care of post-processing the property
values and you could use the the objects in the view templates like you
used to.
I would like the approach, but it somehow conflicts the
(format-)viewhelper idea.
Kind regards
Helmut
More information about the TYPO3-project-typo3v4mvc
mailing list