3212 Posts in 847 Topics by 809 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1094 Views |
-
How do I (correctly) include the jQuery code (or plugins for that matter)

21 February 2011 at 8:41am
If I want to use jQuery, am I responsible for downloading it myself and placing it in my mysite/javascript directory or does SilverStripe do anything cleverer than that? I wondered why jQuery was particularly recommended if there wasn't any specific support for it.
-
Re: How do I (correctly) include the jQuery code (or plugins for that matter)

21 February 2011 at 9:21am Last edited: 21 February 2011 9:22am
I wondered why jQuery was particularly recommended if there wasn't any specific support for it.
jQuery is recommended since a lot of the modules include jQuery (userforms, forum are 2 that I know..) so if you plan on using any modules it's likely it'll include jQuery if it has any front end javascript.
You are responsible for putting your plugins in the mysite folder but take a look first at sapphire/thirdparty. It has a bundle of plugins for jQuery that are used in the CMS so you can include those if you want.
Use <% require javascript(mysite/javascript/plugin.js %> to include plugin JS. Docs: http://doc.silverstripe.org/sapphire/en/reference/requirements
-
Re: How do I (correctly) include the jQuery code (or plugins for that matter)

21 February 2011 at 9:32am
Ah... that makes sense. Thanks!
I didn't know about the thirdparty directory at all.
I downloaded the latest jQuery into a folder in mysite and it all works nicely using 'requirements', so I am happy
| 1094 Views | ||
|
Page:
1
|
Go to Top |


