Smarty.class.php vs JavaScript - Printable Version +- TWLan Forum (https://twlan.org) +-- Forum: Legacy (https://twlan.org/forumdisplay.php?fid=61) +--- Forum: TWLan 1.x (DSLan) (https://twlan.org/forumdisplay.php?fid=62) +---- Forum: English Community (https://twlan.org/forumdisplay.php?fid=64) +----- Forum: Questions & Problems (https://twlan.org/forumdisplay.php?fid=30) +----- Thread: Smarty.class.php vs JavaScript (/showthread.php?tid=43268) |
Smarty.class.php vs JavaScript - tero20051 - 10.11.2013 This thing is consuming my patience and my nerves. Could anyone tell me how to fix this thing, beocuse every time i try to add jd script to the index page, its give me errors like this: Code: Fatal error: Smarty error: [in ../templates/index.tpl line 67]: syntax error: unrecognized tag 'var' (Smarty_Compiler.class.php, line 583) in D:\Documents and Settings\Andrei\Desktop\dslan_v1.4\htdocs\lib\smarty\Smarty.class.php on line 1095 RE: Smarty.class.php vs JavaScript - Molt - 10.11.2013 Then it obviously tries to interpret JavaScript code as Smarty. Please show your index.tpl. Regards Molt RE: Smarty.class.php vs JavaScript - tero20051 - 10.11.2013 Thats the script that i want to use ... Code: <script language="JavaScript"> RE: Smarty.class.php vs JavaScript - Molt - 10.11.2013 (10.11.2013, 20:48)Molt Wrote: Please show your index.tpl. I mean the whole file. RE: Smarty.class.php vs JavaScript - tero20051 - 10.11.2013 PHP Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" RE: Smarty.class.php vs JavaScript - SlimShady95 - 11.11.2013 (10.11.2013, 20:50)tero20051 Wrote: Thats the script that i want to use ... Why don´t you do that with php? PHP Code: $imgs[0]="snob.png"; MfG Manuel RE: Smarty.class.php vs JavaScript - Milu2K - 11.11.2013 I'm not sure, i dont use Smarty, but i think its not allowed to put "{" and "}" in a .tpl file with smarty. You need to save your javascript to a .js file and then load it in HTML with the Script tag like this: PHP Code: <script src="yourJsFile.js"></script> RE: Smarty.class.php vs JavaScript - delacurtais - 11.11.2013 {literal} <script language="JavaScript"> <!-- /* Random Image Link Script- By JavaScript Kit(http://www.javascriptkit.com) Over 200+ free JavaScripts here! Updated: 00/04/25 */ function random_imglink(){ var myimages=new Array() //specify random images below. You can have as many as you wish myimages[1]="snob.png" myimages[2]="spear.png" myimages[3]="spy.png" myimages[4]="paladin.png" myimages[5]="sword.png" myimages[6]="archer.png" //specify corresponding links below var imagelinks=new Array() imagelinks[1]="http://www.javascriptkit.com" imagelinks[2]="http://www.netscape.com" imagelinks[3]="http://www.microsoft.com" imagelinks[4]="http://www.dynamicdrive.com" imagelinks[5]="http://www.freewarejava.com" imagelinks[6]="http://www.cnn.com" var ry=Math.floor(Math.random()*myimages.length) if (ry==0) ry=1 document.write('<a href='+'"'+imagelinks[ry]+'"'+'><img src="'+myimages[ry]+'" border=0></a>') } random_imglink() //--> </script> {/literal} RE: Smarty.class.php vs JavaScript - tero20051 - 11.11.2013 (11.11.2013, 17:02)delacurtais Wrote: {literal} You sir is an genius, thanks you verry mutch ... |