2016-08-30 4 views
1

現在、バージョン2.3.0.2を使用してOpenCartを学習し始めました。Opencartテンプレートがレンダリングされない

私はモジュールを作成しましたが、すべて正常にバックエンドで動作します。

ただし、コントローラからテンプレートを返すと、空白になります。

テンプレートにdie();を追加するとテンプレートが読み込まれます。

コントローラコード:

<?php 
class ControllerExtensionModuleHelloworld extends Controller { 
    public function index() { 
     $this->load->language('extension/module/helloworld'); 

     $data['heading_title'] = $this->language->get('heading_title'); 

     $data['helloworld_value'] = html_entity_decode($this->config->get('helloworld_text_field')); 


     if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/extension/module/helloworld.tpl')) { 
      // print_r(__LINE__); 
      return $this->load->view($this->config->get('config_template') . '/template/extension/module/helloworld.tpl', $data); 
     } else { 
      // print_r(__LINE__); 
      return $this->load->view('extension/module/helloworld.tpl'); 
     } 
    } 
} 

テンプレートコードは:

<div class="panel panel-default"> 
    <div class="panel-heading"> <?php echo $heading_title; ?> </div> 
    <div class="panel-content" style="text-align: center;"> <?php echo $helloworld_value; ?> </div> 
    <div style="height:100px;width:100px;background-color:blue;"></div> 
    </div> 

答えて

1

変更することによってそれを修正:

return $this->load->view('extension/module/helloworld.tpl', $data); 

に:

$this->response->setOutput($this->load->view('extension/module/helloworld.tpl', $data)); 
関連する問題