2017-05-26 36 views
0

我想创建的Prestashop页面,所以我创建的文件夹控制器文件: /contollers/front/MapageController.php我想在的Prestashop 1.7创建一个页面,但我得到一个错误的路径

然后在这个文件我插入此代码:

class MapageControllerCore extends FrontController 
{ 
    public $php_self = 'mapage'; 
    public $page_name = 'ma-page'; 
    public $ssl = true; 
    /** 
    * Initialize Ma Page controller. 
    * 
    * @see FrontController::initContent() 
    */ 
    public function initContent() 
    { 
     parent::initContent(); 
     $this->context->smarty->assign('content_only', 0); 

     $this->setTemplate('costumer/mapage'); 
    } 
} 

我创建mapage.tpl文件中的文件夹costum: /主题/经典/模板/客户

当我认为在浏览器中的地图,我得到这个错误:

[PrestaShopException]

No template found for costumer/mapage at line 68 in file classes/Smarty/TemplateFinder.php

63.      return $tpl; 
64.     } 
65.    } 
66.   } 
67. 
68.   throw new PrestaShopException('No template found for '.$template); 
69.  } 
70. 
71.  private function getTemplateHierarchy($template, $entity, $id) 
72.  { 
73.   $entity = basename($entity); 
  • TemplateFinderCore->是getTemplate - [1340线 - 类/控制器/ FrontController。 php] - [4参数]
  • FrontControllerCore-> getTemplateFile - [line 1236 -
    classes/controller/Fro ntController.php] - [3个参数]
  • FrontControllerCore-> setTemplate - [管线50 -
    控制器/前/ SportsHiverController.php] - [1个参数]
  • SportsHiverControllerCore-> initContent - [线201 -
    类/控制器/ Controller.php这样]
  • ControllerCore->运行 - [线366 - 类/ Dispatcher.php]
  • DispatcherCore->调度 - [28行 - 的index.php]

有人能帮我? 感谢的

回答

0
$this->setTemplate('costumer/mapage'); 

在上面的代码中设置模板,您必须修改这样的代码:

$this->setTemplate('module:modulename/views/templates/front/mapage.tpl'); 

注意:你在你的模块文件夹中创建一个文件mapage.tpl in views/templates/front/

+0

thank's :)我发誓了 – Ahmed

+0

欢迎... @Ahmed – MAC

相关问题