Jump to:

23553 Posts in 19380 Topics by 2892 members

General Questions

SilverStripe Forums » General Questions » Static Publisher - javascript location

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

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

Page: 1
Go to End
Author Topic: 381 Views
  • peterupaulo
    Avatar
    Community Member
    5 Posts

    Static Publisher - javascript location Link to this post

    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.

  • lerni
    Avatar
    Community Member
    80 Posts

    Re: Static Publisher - javascript location Link to this post

    hi

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

    lukas

  • peterupaulo
    Avatar
    Community Member
    5 Posts

    Re: Static Publisher - javascript location Link to this post

    hi lukas

    thanks it works.

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

  • lerni
    Avatar
    Community Member
    80 Posts

    Re: Static Publisher - javascript location Link to this post

    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

    381 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.