title: alternative to Smarty {literal} tags for dynamic JavaScript
body: <p>I have the following Smarty template which is shown in its' entirety which generates some JavaScript.</p>
  
  <p>As you can see I am opening <code>{literal}</code> and closing <code>{/literal}</code> tags all throughout this code snippet, which looks a bit messy and unruly. Is there a better way to write this that would allow the code to appear tidier and more manageable should it have to change in the future?</p>
  
  <pre><code>{literal}
  &lt;script type="text/javascript"&gt;
  var _roi = _roi || [];
  
  // Base Order Details 
  _roi.push(['_setMerchantId', '{/literal}{$merchant_id}{literal}']); 
  _roi.push(['_setOrderId', '{/literal}{$order_id}{literal}']);
  _roi.push(['_setOrderAmount', '{/literal}{$order_total}{literal}']);
  _roi.push(['_setOrderNotes', '{/literal}{$order_notes}{literal}']);
  
  // Line Items
  {/literal}
  {foreach from=$line_items item=line name=items}
      {literal}
      _roi.push(['_addItem', 
      '{/literal}{$line.sku}{literal}',
      '{/literal}{$line.title}{literal}',
      '{/literal}{$line.category_id}{literal}',
      '{/literal}{$line.category}{literal}',
      '{/literal}{$line.price}{literal}',
      '{/literal}{$line.quantity}{literal}'
      ]);
      {/literal}
  {/foreach}
  {literal}
  
  // Submit Transaction to SDC ROI tracker
  _roi.push(['_trackTrans']);
  &lt;/script&gt;
  &lt;script type="text/javascript" src="{/literal}{$url}{literal}"&gt;&lt;/script&gt;{/literal}
  </code></pre>