Web and application development

Twitter

Just discovered dragging a folder from the PHPStorm project explorer into the built in terminal, a new tab opens in that folder. Handy

Follow me
4thJune 2011

Silverstripe and jQuery

Posted at 12:38pm by Jason in Web development

Tags: , ,

This is just a quick post regarding non functioning jQuery plugins and Silverstripe.

If, as a convenience to your admin users, you include the Silverstripe Navigator in your templates then just be aware that this could prevent any 3rd party jQuery plugins from working.

JavaScript Error

If you are not aware of the Silverstripe Navigator, it is the little admin strip at the bottom of the page that provides immediate access to the admin area from the front end of your site. Whilst logged in you are provided with feedback on which version of the site you are looking at (Draft, or Published), and can be very handy. The navigator is added in by placing $SilverStripeNavigator somewhere in the page template. I tend to place it at the bottom.

The issue arises from the fact that Silverstripe then includes its own copy of jQuery from the sapphire/thirdparty folder. Chances are you have probably included your own copy of jQuery and any relevant plugin files before the point that the second copy of jQuery is pulled in. Any plugins are then effectively removed and will not work. You’ll see an error like:

Object #<Object> has no method

leading to some head scratching and checking of include paths etc.

The solution is easy, remove the navigator. The Silverstripe jQuery file is always added to the very bottom of the page and will always been included last.

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.