2016-08-30 5 views
1

Я только начал изучать OpenCart, в настоящее время использую версию 2.3.0.2.Шаблон 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

Fixed, изменив:

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

To:

$this->response->setOutput($this->load->view('extension/module/helloworld.tpl', $data)); 
Смежные вопросы