2017-04-01 133 views
0

我有一些問題,在codeigniter hmvc因爲即時通訊新手與hmvc。查看查看HMVC代碼點火器

我有CI模板引導,所以這個問題就像我無法證明我的觀點

我的目錄「主題」視圖名稱的index.php:

<!DOCTYPE html> 
<html lang="en"> 
<head> 
    <?php echo $this->load->view('theme/header') ?> 
</head> 
<body> 
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation"> 
    <?php echo $this->load->view('theme/navbar') ?> 
</nav> 
<div id="wrapper"> 


    <div id="page-wrapper"> 
     <?php $this->load->view($content) ?> 
    </div> 

</div> 
<?php echo $this->load->view('theme/footer') ?> 
</body> 

我的控制器名稱儀表盤在目錄中 「主題」:

<?php if (! defined('BASEPATH')) exit('No direct script access allowed'); 

class Dashboard extends CI_Controller{ 

    function __construct() 
    { 
     parent::__construct(); 

    } 
    function index() 
    { 
      $data['content'] = 'dashboard'; 
      return $this->load->view('theme/index', $data); 
    } 
} 

我的錯誤是:

<?php echo $this->load->view('theme/navbar') ?> 

<?php echo $this->load->view('theme/footer') ?> 

錯誤表示: 「時遇到PHP錯誤」

「嚴重性:4096」

「的消息:類MY_Loader的對象不能轉換字符串「

」文件名:theme/index.php「

「行號:8」

請幫

回答

0

不使用回聲
只是$this->load->view('viewfile')
例如,如果你的視圖文件是在應用程序/視圖/主題/頁腳那麼

$this->load->view('theme/footer') 

如果要將其轉換爲字符串,則可以傳遞布爾值true第三個參數
$this->load->view('theme/footer',array(),true)

請參閱此codeigniter's view的文件