jQueryObject

CakePHP moved from Javascript helper to a Js helper and they decided to add support Prototype/Scriptaculous, Mootools/Mootools-more, and jQuery/jQuery UI.  Out of the 3, jQuery remains the one I like most so far.  I’m not an expert in it (yet :p) but its pretty nifty to work with.  Sometimes when working with one or more libraries, the jQueryObject which is $ by default tends to clash with other libraries.  CakePHP of course has code to deal with this, only is not publicly mentioned how to do it.  I spent around 5 hours to discover how, and here it goes *drum roll*

$js->JqueryEngine->jQueryObject = '$j';
print $html->scriptBlock('var $j = jQuery.noConflict();', array('inline' => false));

When you look at the code using firebug, you would now see the jQueryObject changed to $j.  I’ve suggested a section to the book for this and I’ve also modified some of the documents for stuff that I found helpful.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s