[TYPO3-dev] new extension: vx_xajax_shoutbox

Ernesto Baschny [cron IT] ernst at cron-it.de
Tue Jul 18 17:59:43 CEST 2006


Elmar Hinz schrieb am 18.07.2006 16:11:

>> If you use the approach of handling your ajax responder in a PAGE object
>> with a different typeNum (say 91), you can just disable caching in this
>> page object altogether. Something like that:
>> 
>> ajax = PAGE
>> ajax.typeNum = 91
>> ajax.no_cache = 1
>> ajax.10 < plugin.tx_yourplugin_pi
>> ajax.10.isAjax = 1
>> 
>> You just have a problem if you are handling your ajax response in the
>> same PAGE/pid/plugin environment as your regular script (which is either
>> an USER or an USER_INT. But I wouldn't recommend that anyway.

> That is an alternative. I still prefer the method of xajax_tutor to this:
> 
> * It doesn't require an extra plugin

No need in typeNum way too. The same plugin will get called, but from
different sources.

> * It doesn't require extra setup

No need too, your extension can provide this in its static template.

> * It needs very few alterations of the existing code

Same here.

> * It has an automatic fallback to classic behaviour if you disable JS

Same too, as its just a matter of where your code is being called (from
a submitted form or from the ajax "obsubmit"). I didn't think this is
what being discussed (at least by me), but:

> For performance the eID method is probably best. But you have to do it all
> without the assistance of the typical TYPO3 environment. Right?

As far as I can see, the xajax_tutor is current using the same "page"
again for the XML response:

// nothing to set, we send to the same URI
# $this->xajax->setRequestURI('xxx');

This is pretty inefficient and should not be the recommended way of
calling the XML-responder. TYPO3 has to potentially load all other
plugins that are running on your page and maybe even render content
objects and the whole page, just so that you just throw that away when
you call processRequests(), which stops the whole process.

This is where the new page object (ajax=PAGE) with another typeNum comes
into action. You tell TYPO3: Load the whole framework, but don't do
anything else except calling my plugin, because we don't want to output
a page. We just want our ajax handler to output the XML.

This is not as efficient as eID (where no framework is loaded and you
have to load the bits you need yourself), but is much more efficient as
the way xajax_tutor is working right now.

And then you can even have your original plugin as an USER object, which
isn't possible in the xajax_tutor way (because TYPO3 won't call your
plugin, except if you set the no_cache parameter, which is even uglier,
because TYPO3 will have to do even MORE stuff).


Cheers,
Ernesto




More information about the TYPO3-dev mailing list