Design help about integrating a javascript library/helper |
[eluser]webtigers[/eluser]
First, install the YUI build files into a publicly accessible folder on your site. I typically use: Code: (docroot)/js/yui/(folders) Second, unpack the YUI config files into a /yui dir within your /library folder (files attached), such as: Code: /application/library/yui/lib/meta/(php and js config files) Third, I created a yui_helper.php class using the YUI loader code (file attached). I usually autoload the helper since I use YUI2 extensively on every page. The helper will want to reference the /application/library/yui/lib/meta/ directory, so if you change this, alter the helper's path to these files. Code: $autoload['helper'] = array('yui'); Now that these files are installed you're ready to pull them into CI. In your base or concrete controller constructor, add the following: Code: public $yui; Now to instantiate any YUI module within your views, simple load the module within the concrete controller. Code: // load YUI components from within the controller Now, within your view, just echo out the $yui var in the head tag: Code: ... ALL DONE! Now, this might seem like a lot to get setup out of the gate, but once this is installed, it's literally a SNAP to include and declude your YUI modules on a page with literally a couple of words of code. Also, what I like about the PHP loader is that it's FAST, much faster than the JS loader which can bog-down the loading of a page if you have quite a few modules being loaded. What's also nice about YUI is that it's a true full-stack framework, unlike libraries like jQuery or Prototype. I've written a couple of articles about YUI on my ProBlog at: http://webtigers.net/javascript/enterprise-javascript/ http://webtigers.net/articles/yui-getelementsby/ CHEERS! |
Messages In This Thread |
Design help about integrating a javascript library/helper - by El Forum - 06-26-2010, 08:31 AM
Design help about integrating a javascript library/helper - by El Forum - 06-26-2010, 04:58 PM
Design help about integrating a javascript library/helper - by El Forum - 06-26-2010, 05:16 PM
Design help about integrating a javascript library/helper - by El Forum - 06-27-2010, 06:37 PM
Design help about integrating a javascript library/helper - by El Forum - 06-28-2010, 02:14 AM
Design help about integrating a javascript library/helper - by El Forum - 06-28-2010, 03:23 AM
Design help about integrating a javascript library/helper - by El Forum - 06-28-2010, 03:34 AM
Design help about integrating a javascript library/helper - by El Forum - 06-28-2010, 03:37 AM
Design help about integrating a javascript library/helper - by El Forum - 06-29-2010, 02:58 AM
Design help about integrating a javascript library/helper - by El Forum - 08-03-2010, 12:54 PM
|