【发布时间】:2011-10-16 23:11:37
【问题描述】:
我不知道该怎么做,因为它没有回显我的 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 ) )
控制器
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:我仍然没有看到正确的页面。
【问题讨论】:
-
该代码来自哪个视图?
-
那是来自内容视图而不是索引视图。
标签: php codeigniter