View Single Post
  #4  
Old 02-02-2008, 01:58 PM
 
inebriate inebriate is offline
 

eXpert
  
Join Date: May 2006
Posts: 301
 

Default Re: Inserting Javascript into Template (used Literal tag)

its better to use {ldelim} and {rdelim} if you have smarty code you want to use inside, it will act as a normal left and right brace,
ie:
Code:
<script language="JavaScript"> <!-- /* Random Image Script- By JavaScript Kit (http://www.javascriptkit.com) Over 400+ free JavaScripts here! Keep this notice intact please */ function random_imglink(){ldelim} var myimages=new Array() //specify random images below. You can have as many as you wish myimages[1]="{$ImagesDir}/ezbail.jpg" myimages[2]="{$ImagesDir}/swivelclamp.jpg" myimages[3]="{$ImagesDir}/speaker.jpg" var ry=Math.floor(Math.random()*myimages.length) if (ry==0) ry=1 document.write('<img src="'+myimages[ry]+'">') {rdelim} random_imglink() //--> </script>

instead of dealing with the opening and closing literal tags for smarty variables, if its just plain javascript with no smarty inside then just wrap with literal tags
__________________
x-cart pro 4.0.18
linux
www.fabric8d.com (currently undergoing construction)
Reply With Quote