furias Posted July 8, 2013 Share Posted July 8, 2013 How can I past code under, to sliders.tpl http://pastebin.com/maWFXBGv <span id="odliczanie"></span> <script type="text/javascript"> //<![CDATA[ d=new Date().getTime()-(<?php echo date(U); ?>*1000) k=new Date(2013,8,31).getTime(); function odl(){ sec=(k-new Date().getTime()+d)/1000; dni=~~(sec/(3600*24)) godzin=~~(sec/3600)%24 minut=~~(sec/60)%60 sekund=~~sec%60 document.getElementById('odliczanie').innerHTML=dni+' dni '+godzin+' godzin '+minut+' minut '+sekund+' sekund'; } odl();setInterval('odl()',1e3) //]]> </script> Link to comment Share on other sites More sharing options...
vekia Posted July 8, 2013 Share Posted July 8, 2013 well, for the first please remove the PHP from code, it will not work in the .tpl (smarty template) files. Next step: create a variable in the $smarty object - in this case you have to edit controller of .tpl file. dont forget about {literal} {/literal} tags before and after the javascript code that you want to use in the template file. if you've got any questions - feel free to continue discussion Link to comment Share on other sites More sharing options...
Recommended Posts