php1 Posted April 16, 2009 Share Posted April 16, 2009 I am using smarty with php. But the javascript inside it is not working. I used {literal} tag .Still it is not working <script type="javascript"> {literal} --js code--- {/literal} </script> Link to comment https://forums.phpfreaks.com/topic/154336-javascript-with-php-smarty/ Share on other sites More sharing options...
Mchl Posted April 16, 2009 Share Posted April 16, 2009 Any errors? How does the source in browser look like? Link to comment https://forums.phpfreaks.com/topic/154336-javascript-with-php-smarty/#findComment-811388 Share on other sites More sharing options...
premiso Posted April 16, 2009 Share Posted April 16, 2009 Chances are the type is wrong. <script type="text/javascript"> Change it to that and see what happens. Link to comment https://forums.phpfreaks.com/topic/154336-javascript-with-php-smarty/#findComment-811503 Share on other sites More sharing options...
gevans Posted April 16, 2009 Share Posted April 16, 2009 Also try testing your javascript on a dummy page, one that doesn't use SMARTY. That way you will know if the problem is with your javascript or the way it's put into your template. Link to comment https://forums.phpfreaks.com/topic/154336-javascript-with-php-smarty/#findComment-811542 Share on other sites More sharing options...
php1 Posted April 17, 2009 Author Share Posted April 17, 2009 i posted the code below.. i changed to test/javascript.. but still no change. i tried on a dummy page it is working. <SCRIPT type="text/javaScript"> {literal} //Disable right click script var message="no right click "; /////////////////////////////////// function clickIE() { if (document.all) {(message);return false; }} function clickNS(e) {if (document.layers||(document.getElementById&&!document.all)) { if (e.which==2||e.which==3) {(message);return false;}}} if (document.layers) {document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;} else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;} document.oncontextmenu=new Function("return false") function setActivity(str,str1) { parent.frames[0].window.document.getElementById('activityName').innerHTML = str+" "+str1; alert ("hi"); var cfrm=confirm("Are you sure to connect IP "+ str1); if(cfrm) { sit1="http://"+str1+"/astgui/showsysyeminfo.php"; site2="http://"+str1+"/astgui/general.php"; parent.frames[1].window.document.location= sit1; parent.frames[2].window.document.location= site2; } } {/literal} </SCRIPT> Link to comment https://forums.phpfreaks.com/topic/154336-javascript-with-php-smarty/#findComment-812085 Share on other sites More sharing options...
gevans Posted April 17, 2009 Share Posted April 17, 2009 Can you show the script around it, even the whole template, and encase it in [ code] tags. Link to comment https://forums.phpfreaks.com/topic/154336-javascript-with-php-smarty/#findComment-812288 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.