[TYPO3-ect] lib/div 1.0 - it's time to say thank you

Elmar HInz elmar.DOT.hinz at team.MINUS.red.DOT.net
Mon Jan 8 14:49:17 CET 2007


Am Mon, 08 Jan 2007 14:12:33 +0100 schrieb Nikolas Hagelstein:

> 
> Hi, 
>> From which source? If it is from the setup, it would come with the
>> configuration object. 
> Lets assume i need to pass  non model related data from a particular
> controller
> to the current view e.g the current users name or something. 
> 

In the controllers action funtion:

$myView->set('username', 'Nikolas Hagelstein');

Please have a look into the class tx_lib_data from wich all views
inherit.

>> I don't understand what several actions are. There has to be always
>> exactly one action, either set in TS (static) or incomming from a
>> form (POST) or from a link (GET). 
> Yes right but a action could result in "a combined view "
> 
> e.g:
> i got the following actions spreaded over 2 controllers.
> controller A->getEmployeesByCompany
> controller B->getCompanyDetails
> 
> To avoid code redundancy A->getEmployeesByCompany should be used in
> several places
> e.g. its returned view should be placed somewhere within
> getCompanyDetails view.

Well. A very simple solution is to use two plugins, if you know both
actions.

But you rather want a composed result and maybe the prarameters for the
one part result from the other.

> 
> The above described issue is known as action chaining or action requests
> withing other frameworks.
> In detail it enables a controller to request an action from annother
> controller and use its returned
> within itself.
> 
> metacode (withincontroller):
> 
> $someView=$this->requestAction('controllerA','someAction');
> // pass $someView to view and output it 
> 

I personally didn't have such a case, so a requestAction function is not
included at the moment. But I see the point and it shouldn't be to
difficult to implement such a function. Just inherit a controller and
implement it there. If it works => typo3xdev on sourceforge.

Such a function would create the subcontroller in the same way the the
outer framework creates the main controller of the plugin. I think this
are mainly 3 steps:

 - creating the object itself
 - setting the current cObj into it
 - calling the main function and handling the localConf to it as
   second parameter

With the localConf you would pass the action of the subcontroller. 

> This technic is extremlly usefull in conjuction with ajax where small
> parts auf a view need
> to be reloaded/updated often.
> 
> This is also related to issue 1.
> 

Data to the subcontroller you could also pass into it as localConf as the
second parameter to the main function. Inside that subcontroller you would
find that data inside the configuration object. Other channels would also
be possible.

Regards

Elmar











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