江湖家居至尊版手机版文章详情页不显示完整导航条,如图:
解决方法:
打开 /themes/default/mobile/article/detail.html 模板文件,在相应位置添加如下导航条代码:
<p class="position black9"><{$detail.dateline|format}>
<span class="ml10">
<a href="<{link ctl='index'}>">首页</a> >
<a href="<{link ctl='article'}>">学装修</a> >
<a href="<{link ctl='article:items' arg0=$top_cate.cat_id}>"><{$top_cate.title}></a>
<{if $top_cate.cat_id != $cate.cat_id}>
><a href="<{link ctl='article:items' arg0=$cate.cat_id}>"><{$cate.title}></a> <{/if}>
</span>
</p>
再打开 /system/home/controllers/mobile/article.ctl.php 控制器文件,查找如下 public function detail($article_id) 函数代码:
public function detail($article_id)
{
if (!($article_id = (int) $article_id) && !($article_id = (int) $this->GP('article_id'))) {
$this->error(404);
}else if (!$detail = K::M('article/article')->detail($article_id)) {
$this->error(404);
}else if(!$cate = K::M('article/cate')->cate($detail['cat_id'])){
$this->error(404);
}else if (!$detail['audit']) {
$this->err->add('内容审核中,不能查看!', 212);
}else if($detail['ontime'] && $detail['ontime'] > __TIME){
$this->err->add('文章还未发布,暂时不可访问', 212);
}else{
K::M('article/article')->update_count($article_id, 'views', 1);
if($detail['linkurl']){
header("Location:".$detail['linkurl']);
exit;
}
$filter['article_id'] = "<>:".$detail['article_id'];
$filter['cat_id'] = $detail['cat_id'];
$this->pagedata['items'] = K::M('article/article')->items($filter, null, 1, 5);
$this->pagedata['detail'] = $detail;
$this->pagedata['content'] = K::M('article/content')->detail($detail['article_id']);
$pager = array();
$pager['backurl'] = $this->mklink('mobile/article:items',array('cat_id'=>$detail['cat_id']));
$this->pagedata['pager'] = $pager;
$this->pagedata['cate'] = $cate;
$seo = array('title'=>$detail['title'], 'article_desc'=>$detail['desc'], 'cate_title'=>$cate['title'], 'cate_name'=>$cate['title'], 'page'=>($page > 1) ? $page : '');
$this->seo->init('article_detail', $seo);
if($seo_title = $detail['seo_title']){
$this->seo->set_title($seo_title);
}
if($seo_description = $detail['seo_description']){
$this->seo->set_description($seo_description);
}
if($seo_keywords = $detail['seo_keywords']){
$this->seo->set_keywords($seo_keywords);
}
$this->tmpl = 'mobile/article/detail.html';
}
替换为:
public function detail($article_id)
{
if (!($article_id = (int) $article_id) && !($article_id = (int) $this->GP('article_id'))) {
$this->error(404);
}else if (!$detail = K::M('article/article')->detail($article_id)) {
$this->error(404);
}else if(!$cate = K::M('article/cate')->cate($detail['cat_id'])){
$this->error(404);
}else if (!$detail['audit']) {
$this->err->add('内容审核中,不能查看!', 212);
}else if($detail['ontime'] && $detail['ontime'] > __TIME){
$this->err->add('文章还未发布,暂时不可访问', 212);
}else{
K::M('article/article')->update_count($article_id, 'views', 1);
if($detail['linkurl']){
header("Location:".$detail['linkurl']);
exit;
}
$filter['article_id'] = "<>:".$detail['article_id'];
$filter['cat_id'] = $detail['cat_id'];
$this->pagedata['items'] = K::M('article/article')->items($filter, null, 1, 5);
$this->pagedata['detail'] = $detail;
$this->pagedata['content'] = K::M('article/content')->detail($detail['article_id']);
$pager = array();
$pager['backurl'] = $this->mklink('mobile/article:items',array('cat_id'=>$detail['cat_id']));
$top_cate = $cate;
$filter['cat_id'] = $cat_id;
if($cate['level'] == 3){
$this->pagedata['childrens'] = K::M('article/cate')->childrens($cate['parent_id']);
}else{
if($cat_ids = K::M('article/cate')->children_ids($cat_id)){
$filter['cat_id'] = explode(',', $cat_ids);
}
if(!$childrens = K::M('article/cate')->childrens($cat_id)){
if($cate['level']>1){
$childrens = K::M('article/cate')->childrens($cate['parent_id']);
}
}
$this->pagedata['childrens'] = $childrens;
}
if($cate['level']>1){
$top_cate = K::M('article/cate')->cate($cate['parent_id']);
}
$this->pagedata['top_cate'] = $top_cate;
$this->pagedata['cate'] = $cate;
$this->pagedata['pager'] = $pager;
$seo = array('title'=>$detail['title'], 'article_desc'=>$detail['desc'], 'cate_title'=>$cate['title'], 'cate_name'=>$cate['title'], 'page'=>($page > 1) ? $page : '');
$this->seo->init('article_detail', $seo);
if($seo_title = $detail['seo_title']){
$this->seo->set_title($seo_title);
}
if($seo_description = $detail['seo_description']){
$this->seo->set_description($seo_description);
}
if($seo_keywords = $detail['seo_keywords']){
$this->seo->set_keywords($seo_keywords);
}
$this->tmpl = 'mobile/article/detail.html';
}
|
|