AJAX controller
rockarena
Joined: 2007-05-03
Posts: 15 |
Posted: Thu, 2007-05-31 10:55 |
I need to make a change to an existing module but for this I want to use AJAX. Does gallery 2 come with an AJAX controller? |
|
Posts: 32509
All AJAX in G2 is done with controller-like immediate-view.
That sounds a bit strange and there is a reason for that.
AJAX doesn't fully fit into G2's MVC framework. Views aren't supposed to do any persistent changes and controllers aren't supposed to print / display data.
When we added the first AJAX handlers in G2, the term AJAX wasn't even born yet and we just tried to fit it into the framework with minimal changes.
We already had "immediate views" which are views that don't use the theme-system and are allowed to print directly to the output. That's why we went with that.
Anyhow, take a look at a few existing AJAX handlers to get an idea how it works:
- modules/core/SimpleCallback.inc
- modules/core/PluginCallback.inc
- modules/exif/SwitchDetailMode.inc (in svn, not in G2.2)
All you need is a GalleryView overriding the isImmediate() and isControllerLike() method() and implementing the renderImmediate() method.
--------------
Documentation: Support / Troubleshooting | Installation, Upgrade, Configuration and Usage