2017-10-26 11 views
0

私は初心者です。私はフロントオフィスコントローラを作成する方法を学んでいます。私は次のコードを書いたが、ページをロードするときに何も表示しない。私はまだ私のモジュールコードでそれへの参照を与えていない。私はどのように進めるべきですか?基本的なフロントオフィスコントローラのプレスタシップの作成1.7

<?php 

if (!defined('_PS_VERSION_')) { 
exit; 
} 

class AbcMyPageModuleFrontController extends ModuleFrontController 
{ 
    public function initContent() 
{ 
    parent::initContent(); 
    $this->setTemplate('module:abc/views/templates/front/myFirst.tpl'); 
} 
} 

答えて

0

あなたのファイルへのあなたのパスが間違っているようで、ここにあなたの目のためのシンプルなバージョンのみです:

<?php 

// Edit name and class according to your files, keep camelcase for class name. 
require_once _PS_MODULE_DIR_.'modulename/modulename.php'; 

class ModuleNameAjaxModuleFrontController extends ModuleFrontController 
{ 
    public function initContent() 
    { 

     $module = new ModuleName; 

     // Usefull vars derivated from getContext 
     $context = Context::getContext(); 
     $cart = $context->cart; 
     $cookie = $context->cookie; 
     $customer = $context->customer; 
     $id_lang = $cookie->id_lang; 


     // Template path : modules/modulename/views/template/front/template.tpl 
     // Just put some vars in your template 
     $this->context->smarty->assign(array('myvar'=>'thevalue')); 
     $this->setTemplate('template.tpl'); 

    } 
} 
は、
関連する問題