我的代码是错误的,或者opencart中有错误

时间:2017-08-21 09:39:23

标签: php css twitter-bootstrap-3 opencart

我为Opencart创建了非常简单的模块,只需在管理面板中显示hello world。这是我的控制器:

<?php

class ControllerExtensionModuleHelloworld extends Controller {

    public function index(){
        $this->load->language('/extension/module/helloworld');
        $this->document->setTitle('Hello World');

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

        $data['header'] = $this->load->controller('common/header');
        $data['column_left'] = $this->load->controller('common/column_left');
        $data['footer'] = $this->load->controller('common/footer');

        $this->response->setOutput($this->load->view('extension/module/helloworld', $data));
    }
}

以下是我的观点:

{{header}}
<div class="container">
    <div class="row>
        <div class="col">
        {{column_left}}
        </div>
        <div class="col">
            <h1>{{heading_title}}</h1>
            <p>{{helloworld}}</p>
        </div>
    </div>
</div>
{{footer}}

问题是h1和p标签显示在左栏下面:problem 我用col-sm-4和col-sm-8更改了col类,如下所示:

{{header}}
<div class="container">
    <div class="row>
        <div class="col-sm-3">
        {{column_left}}
        </div>
        <div class="col-sm-8">
            <h1>{{heading_title}}</h1>
            <p>{{helloworld}}</p>
        </div>
    </div>
</div>
{{footer}}

但这并没有奏效,最后我将col-sm-offset-2类添加到了col-sm-8 div中,它将文本向左移动,就像它假设的那样。 问题可能是什么想法?

1 个答案:

答案 0 :(得分:0)

{{ header }} {{column_left}}
<div id="content">
  <div class="page-header">
    <div class="container-fluid">
      <h1>{{ heading_title }}</h1>
    </div>
  </div>
  <div class="container-fluid">
     <!-- content here -->
  </div>
</div>
{{ footer }}

试试这个,它应该有效。