2015-09-21 18 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)).'/';