Jump to:

1385 Posts in 493 Topics by 522 members


SilverStripe Forums » Themes » JavaScript adding to themplete

Discuss SilverStripe Themes.

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

Page: 1
Go to End
Author Topic: 784 Views
  • silus
    Community Member
    2 Posts

    JavaScript adding to themplete Link to this post


    so, i have this:

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
    <script type="text/javascript" src="js/jquery.easing.1.3.js"></script>
    <script type="text/javascript" src="js/jquery.easing.compatibility.js"></script>
    <script type="text/javascript" src="js/coda-slider.1.1.1.js"></script>
    <script type="text/javascript" src="js/cufon-yui.js"></script>
    <script type="text/javascript" src="js/start.js"></script>
    <script type="text/javascript">Cufon.now();</script>

    and i need to add it to Page.ss
    should it look like this:
    <% static void javascript(http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js) %>
    <% static void javascript(Cufon.now();) %>

    thanks for the reply, coz i cant understand from the manual how to do this.

  • Willr
    Forum Moderator
    5511 Posts

    Re: JavaScript adding to themplete Link to this post

    See http://doc.silverstripe.org/sapphire/en/reference/requirements#including-inside-template-files.

    For the final line you can just keep it as a script tag.

    If you're including all those files, perhaps you want to minify and combine the files. This time in your PHP Page.php init function (has to be via the Requirements PHP API as the template one doesn't support the syntax in 2.*)

    Requirements::combine_files("main.js", array(

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.