[TYPO3-ect] Using 'action' in lib/div

Elmar HInz elmar.hinz at team.MINUS.red.DOT.net
Thu Mar 15 21:04:38 CET 2007


Am Thu, 15 Mar 2007 08:28:42 -0500 schrieb R. van Twisk:

> hey Guys,
> 
> 
> I am making a plugin with a lot of different functions (gallery, press 
> releases, awards etc etc etc)
> 
> I basicly have two questions
> 
> 
> 1) I want to have for each functionality a different desgination.
> Is it correct to say that I need to set it in my controller like this? : 
> $this -> setDefaultDesignator('press_releases');


In the taget plugin, that "unpacks" the parameters, you set it as you
discribe or you set it already in the var declarations:

 class tx_press_releases extends tx_lib_controller {

  var $defaultDesignator = 'press_releases';
  ...

You can set the designator you want to use to the link directly 
or set the defaultDesignator and call it from there. That depends also on
the question if you link to the same or a foreign plugin.

> 
> 
> 2) I have read about 'actions' But looking at eFaq it shows a lot of 
> 'magic'. So my question is,
> what is a action and how can I use it? I 'think' I can use a action to 
> execute
> a different function based on form input. However I am not totally sure.
> 

The rule of thumb is: Give every plugin it's own controller. That you can
use different actions like you need it for processing of a form. That is
easy to understand. 

You see this in new versions of efaq. Additionally efaq uses the
controllerSwitch technology a kind of nested USER objects.

The magic is no magic. In tx_efaq_controllers_common I set the default
action to "clear" for all inherited controllers. I also define default
actions here.



On the other hand you often have multiple mini plugins that each only have
one action and no more. This can share a common controller, where you
assign one action to each plugin. This can same some work.

You assign the action by setting

  action = xyAction or action = xy  (both has the same effect)

in the plugins TS.

You can find this technology still in older efaq versions:

http://typo3.org/extensions/repository/view/efaq/0.1.0/info/configuration%252Fsetup.txt/

For a beginner I recommend to chose the first solution without a
controllerSwitch.

I hope this is of help.

Regards

Elmar






















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