Pregunta

I know the following functions is used for displaying form in prestashop.

     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;
      }

But i want to know how to do that same operation using .tpl file

¿Fue útil?

Solución

TPL files can be displayed in module hooks:

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>

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top