2014-04-05 79 views
0

我知道以下函数用于在prestashop中显示表单。如何在prestashop中创建tpl文件?

 public function getContent() 
     { 
      $this->_html="<h2>".$this->name."</h2><form> 
    <label>Username</label> 
    <input type='text' name='username'><br> 
    <label>Password</label> 
    <input type='text' name='password'><br> 
    <input type='submit' name='save' value='save'> 
</form>"; 
      return $this->_html; 
     } 

但我想知道如何使用.tpl文件

回答

1

TPL文件做同样的操作可以显示模块挂钩:

public function hookLeftColumn($params) 
{ 
    $this->smarty->assign(
    array(
     'name' => $this->name, 
    ) 
); 
    return $this->display(__FILE__, 'example.tpl'); 
} 

example.tpl:

<h2>{$name}</h2> <form> <label>Username</label> <input type='text' name='username'><br> <label>Password</label> <input type='text' name='password'><br> <input type='submit' name='save' value='save'> </form>

相关问题