title: Using class with smarty
body: <p>I'm very new to php and smarty.</p>
  
  <p>I'm trying to call a function but can't understand why it's undefined.
  Here is my code: </p>
  
  <pre>
  include 'header.php';
  
  include 'template/footer.tpl';
  
  class indexmessage{
  
      function message(){
  
          global $pdo;
  
          $query = $pdo->prepare("SELECT * FROM hovedside WHERE id = 1");
          $query->execute;
  
          return fetchAll();
  
      }
  }
  
  
  $smarty->assign('indexmessage', message());
  
  $smarty->display('index.tpl');
  </pre>
  
  <p>What am I doing wrong?</p>