load("calendar"); ?> YUI PHP Loader Utility Advanced Example: Mixed Loading Methods css(); ?>

YUI PHP Loader Utility Advanced Example: Mixed Loading Methods

In this example, we bring a YUI component onto the page using the YUI PHP Loader Utility. This example implements YUI PHP Loader via a YAHOO_util_Loader instance. We include the YUI PHP Loader class file, then specify in configuration which component we want loaded on the page — and what we want to do once it is loaded. The main difference between this example and the previous advanced example is that we have mixed the component loading methods. The Calender component requires the Yahoo, Dom, and Event modules. In the previous example we let PHP Loader bring these into the document for us. However, in this case we placed a static script include into the document that brings in these resources. We do not wish to have PHP Loader duplicate the loading of these components so we utilize the setLoaded method to notify PHP Loader that we already have these components in the document and to skip loading them a second time.

setLoaded("yahoo", "dom", "event"); echo $loader->script(); ?>