[TYPO3-ect] Integrate ajax with extensions
Ernesto Baschny [cron IT]
ernst at cron-it.de
Wed Jul 12 18:54:59 CEST 2006
Christoph Koehler schrieb am 12.07.2006 18:32:
>> One way to do it is to tie your ajax responder to a specific page type
>> and then set that up in your template. Eg:
>>
>> ajaxPage = page
>> ajaxPage.typeNum = 99
>> ajaxPage.10 < plugin.tx_ajaxResponder_pi1
>>
>> Then, your calls to the ajax responder include &type=99 in the URL,
>> which tells your template to look to your responder PHP script for
>> output -- that script is then responsible for returning the XML
>> response. That's the general approach we've taken when we the eID
>> approach hasn't been sufficent.
> I am still working on cwt_community, and one of the modules of it is
> supposed to be a status bar that updates some stuff using AJAX (new
> messages).
> So it will always be on a page together with the other modules of my
> extension.
> Can I still do it like that?
>
> ajaxPage = page
> ajaxPage.typeNum = 99
> ajaxPage.10 < plugin.tx_cwtcommunity_pi1
>
> Would that call my main function? Sorry, I guess I don't quite get it,
> thanks for trying though!!
You have two sides of an Ajax component:
1) The javascript which calls (asynchronously) your server to update
your page "dynamically"
2) The ajax responder, which is what the javascript calls and which
returns something the javascript can work with (usually some XML).
So the javascript can be placed wherever you want it, just output it in
your normal "plugin".
The ajax responder doesn't need to be placed anywhere "on the page",
because it won't generate any page: it will only generate XML with which
the javascript will work with. This is the above mentioned "ajaxPage"
that loads the T3-framework, but just outputs the XML that you need. If
this is the same plugin as your regular extension, just pass it some
parameter which your plugin will identify as a "ajax request":
ajaxPage = page
ajaxPage.typeNum = 99
ajaxPage.10 < plugin.tx_cwtcommunity_pi1
ajaxPage.10.isAjax = 1
Then just check for $conf['isAjax'] first thing in your pi1 and act
acordingly.
Cheers,
Ernesto
More information about the TYPO3-team-extension-coordination
mailing list