私は Codeigniter を使用しており、レイアウトを含む独自のコントローラーを定義しています
protected $layout = 'layout';
protected function render($content) {
$view_data = array(
'content' => $content
);
$this->load->view($this->layout,$view_data);
}
すべてのコントローラーは、ビューを呼び出して独自のコンテンツを定義する際にこれを拡張します
class Voyage extends My_Controller {
function index(){
$this->load->helper('form');
$this->load->helper('url');
$content = $this->load->view('admin\voyages');
$this->render($content);
}
私のhtmlページは次のようなものです:
<body>
<header>.....</header>
<nav>......</nav>
<section>.. <?php echo $content; ?>...</sectiont>
問題は、私の echo $content がヘッダーとナビゲーション要素の前にページの上部にコンテンツを配置していることです。
これで私を助けてもらえますか?