EvanAgee Posted October 1, 2008 Share Posted October 1, 2008 Okay, so this is a little difficult to explain.... I'm creating a PHP-powered AJAX interface that generates a list of items. What I'm wanting to do is make that list of items sortable so I'm using the scriptaculous Sortable.create method. Here's where it gets tricky. So my php file displays my result set using a Smarty template. The problem is that the smarty template (which contains the javascript that triggers the Sortable.create method doesn't appear to be included in the template when it's displayed, there's a blank spot in the source where the JS should be. Here's the JS that's at the bottom of my Smarty template: <script type="text/javascript"> {literal} <!-- Sortable.create("results_table", { onUpdate:function(){ alert(Sortable.sequence('results_table').join('')); } }); --> {/literal} </script> Any ideas? Quote Link to comment Share on other sites More sharing options...
billshk13 Posted April 9, 2009 Share Posted April 9, 2009 I have the same exact problem, a simple javascript code enclosed by literal smarty tags and the script will not generate in the page. Has there been any luck or success on this issue? Quote Link to comment Share on other sites More sharing options...
black.horizons Posted May 19, 2009 Share Posted May 19, 2009 try putting the literal tag outside the <script type=""> and script e.g. {literal} <script type="text/javascript"> <!-- Sortable.create("results_table", { onUpdate:function(){ alert(Sortable.sequence('results_table').join('')); } }); --> </script> {/literal} Quote Link to comment Share on other sites More sharing options...
AKA_ANTO Posted April 2, 2010 Share Posted April 2, 2010 i know what the problem is... See, probably u have ur js function in the template/html document where u want it to be executed, but turns out that u need it where ur template/html document is going to be located so it can be executed , is the same problem with images when we dont chance the url according to the document who gets the template.... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.