title: How to create a smarty variable in prestashop 1.5
body: <p>I am working on a button that switches view with onClick. I wish to store the last/default position in a variable in order to prevent switching to the default view state on each page refresh or navigation. </p>
  
  <p>I read that I can do the following in a php file:</p>
  
  <pre><code>$myVar= -1;
  $smarty-&gt;assign('myVar', $myVar);
  </code></pre>
  
  <p>and then use <code>$myVar</code> in the tpl file. But it does not work for me. 
  The tpl file I am working on is not part of a module and has no .php file in the prestashop root folder. </p>
  
  <p>Can anyone educate me a little on smarty/php and how to create variables and use them to store button's state?</p>
  
  <p>Thanks</p>