Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Template Questions

Variables inside inline Javascript ?


Reply

3 Posts   1302 Views

Avatar
pinkp

9 June 2010 at 12:08am Community Member, 168 Posts

Is it possible to put Variables inside inline Javascript:

Where $SlideShowSpeed will become a number from the CMS, currently it outputs nothing...

MyPage.ss

...
<script type="text/javascript">//<![CDATA[
...
   //Call the rotator function to run the slideshow, 6000 = change to next image after 6 seconds
   setInterval('rotate()', {$SlideShowSpeed}000);
   
}
...
//]]></script>
...

Avatar
bartvanirsel

9 June 2010 at 7:44am Community Member, 94 Posts

yes this is posible.

create a method in the controller with the name SlideShowSpeed which returns the value.

Avatar
pinkp

9 June 2010 at 7:50am Community Member, 168 Posts

Sorry I wasn't very clear, I have already created the method the problem was it was returning nothing, but after your suggestion I found I was calling the wrong one in the template!! apologies thanks though