2015-09-21 21 views
0

我想扩展Prestashop(1.6.1.1)的form.tpl。为此我创建了下面的路径在我的模块文件夹:PHP Prestashop扩展form.tpl

模块/ mymodule中/视图/模板/管理/导出/助手/表格/ form.tpl

模块/mymodule/views/templates/admin/helpers/form/form.tpl

form.tpl

{extends file="helpers/form/form.tpl"} 

{block name="input"} 
    {if $input.type == "test"} 
     <div class="form-group"> 
      <input type="text" name="test" class="form-control" placeholder="Te"> 
     </div> 
    {/if} 
{/block} 

AdminExportController.php

public function renderForm() { 
    $this->fields_form = array(
     'legend' => array(
      'title' => 'test' 
     ), 
     'input' => array(
      'type' => 'test' 
     ) 
    ); 

    return parent::renderForm(); 
} 

但没有在我的形式显示出来:/有什么建议?

回答

0

默认你可以把你的form.tpl在以下文件夹: {module_dir} /视图/模板/管理/ {AdminController-> tpl_folder} /helpers/form/form.tpl。

为{AdminController-> tpl_folder}的值可以在类AdminController.php检索:

// Get the name of the folder containing the custom tpl files 
$this->tpl_folder = Tools::toUnderscoreCase(substr($this->controller_name, 5)).'/';