18590 Posts in 4875 Topics by 2285 members
General Questions
SilverStripe Forums » General Questions » inserting javascript in template
General questions about getting started with SilverStripe that don't fit in any of the categories above.
Moderators: martimiz, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba
|
Page:
1
|
Go to End | |
| Author | Topic: | 1037 Views |
-
inserting javascript in template

31 December 2009 at 11:42pm
hello
I am trying to insert a 3d gallery in my homepage,thought the gallery is running fine in a normal html page,i want to insert the same gallery in silverstripe.
My gallery consist of a js file(javascript file) one XML file which have information about the picture i am using and a html code to call the files.all the files are under a folder under the root.
when i insert the below code the gallery is showing correctly in a html file<script type="text/javascript">
var fo = new SWFObject("TiltViewer.swf", "viewer", "100%", "100%", "9.0.28", "#000000");
// XML GALLERY OPTIONS
// To use local images defined in an XML document, use this block
fo.addVariable("useFlickr", "false");
fo.addVariable("xmlURL", "gallery.xml");
fo.addVariable("maxJPGSize","640");
//GENERAL OPTIONS
fo.addVariable("useReloadButton", "false");
fo.addVariable("columns", "3");
fo.addVariable("rows", "3");
// END TILTVIEWER CONFIGURATION OPTIONS
fo.addParam("allowFullScreen","true");
fo.write("flashcontent");
</script>Please help me in inserting this code in homepage
-
Re: inserting javascript in template

1 January 2010 at 5:31am
Well the easiest way is to just wrap the Javascript in an if control in your Page.ss
<% if Title == "Home" %>
insert your code here
<% end_if %> -
Re: inserting javascript in template

20 January 2010 at 2:57am
Hello I tried the suggested way but its not working any alternative
-
Re: inserting javascript in template

20 January 2010 at 12:53pm
How is it not working? Is the Javascript not being rendered or the javascript not working?
-
Re: inserting javascript in template

20 January 2010 at 11:52pm
when I have added the code as per your instruction nothing is displayed on the page do i need to give the path of xml and swf file ,how to do that
-
Re: inserting javascript in template

21 January 2010 at 3:52am
Nothing is rendering at All? You get a totally blank page. Did the page work before?
-
Re: inserting javascript in template

24 January 2010 at 9:18am
If its only the flash thats not working you probably it probably can't find your XML file or the call to the flash file is wrong. You shoudl be able to embed a flash file liek you would in a static page and then configure it per the Flash Viewers instructions to find the XML
| 1037 Views | ||
|
Page:
1
|
Go to Top |


