Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cms made simple how to include javascript in my template

Hi I'm a bit stuck here, i cant seem to be able to include the javascript file in my cmsms template.

<script src="js/slides.min.jquery.js"></script>
<script>
    $(function(){
        $('#slides').slides({
            preload: true,
            preloadImage: 'img/loading.gif',
            play: 5000,
            pause: 2500,
            hoverPause: true
        });
    });
</script>

This code doesent work, it neither includes the js/slides.min.jquery.js nor does it run the script,, can any one please explain how javascript is included in cmsms templates...

like image 712
Umer Hassam Avatar asked Apr 15 '11 10:04

Umer Hassam


1 Answers

You need to include the javascript in {literal} tags, to avoid cmsms trying to parse it. This is an example (from one of my sites), that includes the Google analytics javascript.

{literal}
<script type="text/javascript">

 var _gaq = _gaq || [];
 _gaq.push(['_setAccount', 'UA-XXXXXXX-X']);
 _gaq.push(['_trackPageview']);

 (function() {
  var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
 ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') +     '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
 })();

</script>
{/literal}
like image 131
uvesten Avatar answered Sep 16 '22 19:09

uvesten