title: How to increment variable using foreach in smarty?
body: <p>This is my assigned variable</p>
  
  <pre><code> {assign var="count" value=0}
  </code></pre>
  
  <p>I put the variable in foreach statement</p>
  
  <pre><code>{foreach from=$name item=names}
     {assign var="count" value=$count+1}
  {/foreach}
  </code></pre>
  
  <p>Want to display variable in div named "friendsCount"</p>
  
  <pre><code>&lt;div class="friendsCount"&gt;
     Total friends:{$count}
  &lt;/div&gt;
  </code></pre>
  
  <p>But when the program error message is displaying " Trying to get property of non-object". Please help me to find a solution. Am using codeigniter</p>