1259 Posts in 348 Topics by 484 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 471 Views |
-
JavaScript adding to themplete

7 January 2012 at 3:23am
hi!
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.
-
Re: JavaScript adding to themplete

7 January 2012 at 9:03pm
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(
"js/jquery.easing.1.3.js",
"js/jquery.easing.compatibility.js",
"js/coda-slider.1.1.1.js",
"js/cufon-yui.js",
"js/start.js"
));
| 471 Views | ||
|
Page:
1
|
Go to Top |


