Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Javascript location


Go to End


3 Posts   1641 Views

Avatar
Mo

Community Member, 541 Posts

18 March 2009 at 3:37am

Hi all,

Just started working with SIlverStripe and am quite impressed so far. Great job all of you! :)

I had a quick question (I am sure on of many), is it possible to change the location that the Requirements class places JavaScript files? I am loading jQuery and the jQuery corners plugin, but currently it is placing the <script> tags just before the </body> tag.

It would be nice if I could move them to be rendered inside the <head> tags instead. Is this do-able?

Many thanks,

Mo

Avatar
Invader_Zim

Community Member, 141 Posts

19 March 2009 at 12:42am

Edited: 19/03/2009 12:42am

Hi.

You can disable writing all javascripts to the body and include them in the head by setting this in your mysite/_config file :

Requirements::set_write_js_to_body(false);

Cheers,
Christian

Avatar
Mo

Community Member, 541 Posts

19 March 2009 at 1:34am

That is ACE! Thanks ever so much :).