title: smarty variables inside javascript
body: <p>I am trying to use smarty variables inside javascript inside tpl</p>
  
  <pre><code>{literal}
  &lt;script language="javascript"&gt;
    google.load('visualization','1',{'packages': ['geomap']});
    google.setOnLoadCallback(drawMap);
  
  
    function drawMap() {
      var data = new google.visualization.DataTable();
      data.addRows(4);
      data.addColumn('string', 'Location');
      data.addColumn('number', 'Number of links');
  
  {/literal}{foreach from=$last5 item=link name=links key=index}
      data.setValue({$index},0,'{$link.location|replace:'\'':'\\\''}');
      data.setValue({$index},1,{$link.location_count});
  {/foreach}{literal}
  
      var options = {};
      options['dataMode'] = 'regions';
      options['region'] = 'world';
  
      var container = document.getElementById('map');
      var geomap = new google.visualization.GeoMap(container);
  
      geomap.draw(data, options);
    };
  &lt;/script&gt;
  {/literal}
  </code></pre>
  
  <p>can you suggest me a solution please</p>