posted on 1:39 PM, September 24, 2007
ExSite provides a simple AJAX interface that works with any ExSite plug-in. The plug-in does not have to be written with an understanding of AJAX. ExSite manages the AJAX protocol on behalf of the plug-in, which means that every plug-in is automatically AJAX-capable. That is to say, an ExSite plug-in will work as a conventional web application or an AJAX plug-in with no extra effort on behalf of the programmer.
How to run a plug-in in AJAX modePlug-ins are invoked using a specially-formatted HTML tag that looks like this:
<!--&MyPlugin(parameters)-->where "MyPlugin" is the name of the plug-in being invoked, and "parameters" is an optional parameter string that gets passed to the plug-in to request particular types of output.
The above syntax invokes the plug-in in conventional mode; the plug-in content is fetched at the time the page is built, and inlined into the HTML that is returned to the client browser. If the plug-in generates any self-referential links, those will regenerate the entire page from scratch.
To invoke the plug-in in AJAX mode, simply add an extra ampersand to the above tag:
To have all of the plug-in links be AJAX-enabled so that you stay in AJAX mode as you click your way through the plug-in data, add one more ampersand to the above tag:
<!--&&&MyPlugin(parameters)-->Now, all of the self-referential links are modified to be AJAX-friendly. As long as you stay within your plug-in's links, your main page is never refreshed, and you may experience a faster, smoother interface to the plug-in.
Which Plug-in Method Should I Use?Use full-AJAX (triple-ampersand) when:
ExamplesThe Calendar plug-in allows the viewer to browse through various month views and check out the events scheduled in each month. Many sites desire to include a "preview" of upcoming events in a sidebar or other secondary content area on published pages (especially the home page, index.html). This can be a problem if those pages are published infrequently, since the preview will become stale. Half-AJAX solves this problem by generating the preview dynamically and inserting it into the older published page:
<!--&&Calendar(upcoming)-->The SlideShow plug-in allows the viewer to page through the various images in an album/library. Each click to the next image redraws the entire page, which is both slow and jerky. You can get a smoother slideshow effect by running in full-AJAX mode, so that the main page is unaffected, and only the slideshow itself is updated:
<!--&&&SlideShow()-->Note that the slideshow will be smoothest if the images are all of the same or similar dimensions. Widely-differing image sizes may cause the page itself to reflow as each new image is inserted.
Best PracticesAlthough the plug-in programmer does not have to go to special effort to support AJAX, you still must follow some standard practices to ensure that your plug-in will behave as ExSite expects:
best practices (5)
content management (12)
data handling (7)
graphic design (21)
html formatting (7)
plug-in modules (28)
visual tutorial (29)
web protocols (9)