[TYPO3-ect] ajax and class per controller model

Elmar Hinz elmar.DOT.hinz at team.MINUS.red.DOT.net
Wed Jun 27 13:32:51 CEST 2007


Hi Christian,


> My main goal is to make an exsisting action callable through ajax. i do
> not want to generate a new action only for that case. so my idea was to
> use the switch-class with an get parameter in the url for the action
> (something like "http://host/index.php?id=xxx&type=yyy&action=foo" as
> url for xajax). but the switch does only react on flexform not on get
> parameters.

Hmm, the type parameter is a special one that is used within TS to switch
page types. Working with a different page type is so far my preferred
option for xajax, but I didn't try how it would work with Eid (right name?).

The xajax setup from efaq currently looks like this:

# The ajax response
efaqAjaxResponse = PAGE
efaqAjaxResponse.typeNum = {$plugins.efaq.ajaxPageType}
efaqAjaxResponse.config.disableAllHeaderCode = true
efaqAjaxResponse.50 = USER_INT
efaqAjaxResponse.50 {
        userFunc = tx_efaq_controllers_xajax->main
        setupPath = plugin.tx_efaq.configurations.
}

I use an own controller for xajax here. If I understand you right, you want
to reuse the regular controllers instead? A more general solution.

We don't have plugins with ajax. So you need a different type of switch and
an additional parameter to select. 

(This additional parameters carries informations that we find otherwise
indirectly via the relation of the tables pages and tt_content.)

a) You could work with different types:

efaqAjaxResponse1.typeNum = {$plugins.efaq.ajaxPageType1}
...
efaqAjaxResponse2.typeNum = {$plugins.efaq.ajaxPageType2}
...

b) You could work with one type, one additional parameter (controller) and
a TS CASE object:

http://host/index.php?id=xxx&type=yyy&controller=foo&action=bar

efaqAjaxResponse = PAGE
efaqAjaxResponse.typeNum = {$plugins.efaq.ajaxPageType}
efaqAjaxResponse.config.disableAllHeaderCode = true
efaqAjaxResponse.50 = CASE
efaqAjaxResponse.50 {
  key.data = GPvar : controller
  aaaa = USER_INT
  aaaa {
        userFunc = tx_efaq_controllers_aaaa->main
        setupPath = plugin.tx_efaq.configurations.
  }
  bbbb = USER_INT
  bbbb {
        userFunc = tx_efaq_controllers_bbbb->main
        setupPath = plugin.tx_efaq.configurations.
}

That are my first ideas.


Regards

Elmar


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