title: How to assign an array of objects within a smarty template file
body: <p>I have an array of stdclass objects.
  How can I assign it to a smarty template?</p>
  
  <p>I tried to do this:</p>
  
  <pre><code>$smarty-&gt;assign( 'objects', $x-&gt;getAllObjects() ); 
  </code></pre>
  
  <p>but the result is an error: </p>
  
  <pre><code>Catchable fatal error: Object of class Object could not be converted to string
  </code></pre>
  
  <p>Thanks</p>
  
  <p><strong>edit</strong>: I also tried:</p>
  
  <pre><code>$smarty-&gt;registerObject( 'objects', $x-&gt;getAllObjects() );
  </code></pre>
  
  <p>and in the template file I did:</p>
  
  <pre><code>{foreach from=$objects item=o}
    {$o}
  {/foreach} 
  </code></pre>
  
  <p>but I get a notice:</p>
  
  <pre><code>Notice: Undefined index: objects
  </code></pre>
  
  <p>and I can't access the elements of <code>objects</code> array.</p>