I'm in the process of shifting a web application from a PHP/MySQL backend to the Grails framework. However, the app has a fair bit of legacy javascript code written for it that I'd like to use with minimal re-writing. Its currently not working, and I'm not sure why.
A friend wrote a fade out slideshow script that requires an array initialized as
var images[3];
images[0] = ['path to image', 'link to somewhere', 'target'];
When writing in PHP, I just used the relative path and double quotes for the link and target, ie
images[0] = ["../images/file.jpg", "", ""]
Shifting to Grails, I want to have the slideshow visible on all pages, thus resuling in insertion in main.gsp.
I've declared the javascript link in the head as
<g:javascript src="fade_in.js" />
The way the original script worked was the image array was initalized in the script, then passed in via a function call in the body code. Since I don't know if its possible to use a Grails createLinkTo function call in a js file, I initialized the array and called the function with
<div id="slideshow">
<script type="text/javascript">
var images[3];
images[0] = ["<g:createLinkTo dir='images' file='nsf.jpg' />", "", ""]
images[1] = ["<g:createLinkTo dir='images' file='east.jpg'/>", "", ""]
images[2] = ["<g:createLinkTo dir='images' file='usm_horz.png' />", "", ""]
new fadeshow(fadeimages,200,118,0,8000,1,"R");
</script>
</div>
According to firebug, the paths to the files is correct, but they're not showing up in the specified div position. I can see where the images should be, and its empty.
So, what needs to be done to integrate this functionality with a Grails app?