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   1308 Views

Avatar
pinkp

Community Member, 168 Posts

9 June 2010 at 12:08am

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

Community Member, 94 Posts

9 June 2010 at 7:44am

yes this is posible.

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

Avatar
pinkp

Community Member, 168 Posts

9 June 2010 at 7:50am

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