title: how to assign an object to smarty templates?
body: <p>i created a model object in PHP</p>
  
  <pre><code>class User {
    public $title;
  
    public function changeTitle($newTitle){
      $this-&gt;title = $newTitle; 
    }
  }
  </code></pre>
  
  <p>How do i expose the property of a User object in smarty just by assigning the object?</p>
  
  <p>I know i can do this </p>
  
  <pre><code>$smarty-&gt;assign('title', $user-&gt;title);
  </code></pre>
  
  <p>but my object has something like over 20 plus properties.</p>
  
  <p>Please advise.</p>
  
  <p><strong>EDIT 1</strong></p>
  
  <p>the following didn't work for me.</p>
  
  <pre><code>$smarty-&gt;assign('user', $user);
  </code></pre>
  
  <p>OR</p>
  
  <pre><code>$smarty-&gt;register_object('user', $user);
  </code></pre>
  
  <p>then i try to <code>{$user-&gt;title}</code></p>
  
  <p>nothing came out.</p>
  
  <p><strong>EDIT 2</strong></p>
  
  <p>I am only currently trying to output the public property of the object in the smarty template. Sorry if i confused any one with the function.</p>
  
  <p>Thank you.</p>