我不知道如何做到這一點,因爲它沒有迴應我的HTML。它顯示螢火蟲div標籤,但沒有任何其他的後,它應該是索引頁(主頁)或我的404頁面。應該發生的是它應該找出它應該通過if語句加載哪個頁面視圖,然後在內容頁面中加載該視圖。不顯示查看頁面
控制器:
$siteInfo = $this->kow->getSiteTitleAndSlogan();
$activeTemplate = $this->kow->getTemplate();
if ($this->kow->pageStatus('index', $activeTemplate[0]->short_name) == 1){
$page = $this->load->view($activeTemplate[0]->short_name.'/pages/index');
} else {
$page = $this->load->view($activeTemplate[0]->short_name.'/pages/404');
}
$footerLinks = $this->kow->getFooterNav();
$this->template
->title($siteInfo[0]->site_name,$siteInfo[0]->site_slogan)
->prepend_metadata('<link rel="stylesheet" type="text/css" href="http://www.kansasoutlawwrestling.com/assets/css/'.$activeTemplate[0]->short_name.'.css" />')
->set('footerLinks', $footerLinks)
->set('page', $page)
->set_partial('header', $activeTemplate[0]->short_name.'/header')
->set_partial('navigation', $activeTemplate[0]->short_name.'/navigation')
->set_partial('content', $activeTemplate[0]->short_name.'/content')
->set_partial('footer', $activeTemplate[0]->short_name.'/footer')
->build('kow');
if ($this->kow->pageStatus('index', $activeTemplate[0]->short_name) == 1){
$page = $this->load->view($activeTemplate[0]->short_name.'/pages/index');
} else {
$page = $this->load->view($activeTemplate[0]->short_name.'/pages/404');
}
查看:
<div id="content">
<?php
echo $page;
?>
</div>
編輯:我試圖做的是採取積極模版的id和字符串索引到pageStatus功能,並找出如果頁面的狀態值爲1.當我運行下面的print_r函數時,我得到:
Array ([0] => Array ([status_id] => 1))
Con troller
if ($this->kow->pageStatus('index', $activeTemplate[0]->id) == 1){
$page = $this->load->view($activeTemplate[0]->short_name.'/pages/index', '', true);
} else {
$page = $this->load->view($activeTemplate[0]->short_name.'/pages/404', '', true);
}
print_r($this->kow->pageStatus('index', $activeTemplate[0]->id));
編輯2:我還沒有得到正確的頁面查看。
哪個視圖是代碼? –
這是從內容視圖而不是索引視圖。 –