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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Static Publisher - javascript location


Go to End


4 Posts   1534 Views

Avatar
peterupaulo

Community Member, 5 Posts

13 July 2012 at 2:25pm

I would like to if anyone has observed this. If i don't use cache the scripts are located in the header but if i enable the cache the scripts are located inside the body. I need them to be located on the header.

I have already set the Requirements::set_write_js_to_body(false);

Any help is greatly appreciated. Thanks.

Avatar
lerni

Community Member, 81 Posts

14 July 2012 at 12:23pm

hi

do you have script tags in the template? if so try <% require javascript(mysite/javascript/xyz.js) %>

lukas

Avatar
peterupaulo

Community Member, 5 Posts

6 August 2012 at 2:15pm

hi lukas

thanks it works.

It's probably that i put the js files in the php instead in the template file.

Avatar
lerni

Community Member, 81 Posts

7 August 2012 at 7:50am

hi Peter Paul

If you put scripttags like <script>... directly in the templates, SS adds the rest of the scripts Requirements underneath the first scripttag. AFAIK it does not make a difference, if you add Requirements per php or per <% require ... %>.

lukas