帮看看PHP同分类下上一篇下一篇文章这样写对不对
默认的是如下$article['pre']=$modArticle->getPre($this->id);$article['next']=$modArticle->ge...
默认的是如下
$article['pre'] = $modArticle->getPre($this->id);
$article['next'] = $modArticle->getNext($this->id);
$url = array($modArticle, 'getUrl', $this->id);
$article['attach_num'] = $modAttach->getAttachNum($this->id);
$pageInfo = new Ext_Page($url, $article['attach_num'], $this->page,
我修改成这样
<?php
$cates = get_the_cate();
$cateIDS = array();
foreach ($cates as $cate) {
array_push($cateIDS, $cate->term_id);
}
$cateIDS = implode(",", $cateIDS);
?>
<?php
if (get_previous_article($cateIDS)) { previous_article_url('上一篇:
%url','%article_title',true);} else { echo "已是最后文章";} ?>
<?php
if (get_next_article($categoryIDS)) { next_article_url('上一篇:
%url','%article_title',true);} else { echo "已是最新文章";} ?>
不知道这样改对不对
在HTML里面表现为这样
<!--{if $article.pre}-->
<a href="{$article.pre.url}" class="prev_detail"><b class="icon icon_arrow_left"></b>上一篇:{$article.pre.title}</a>
<!--{/if}-->
<!--{if $article.next}-->
<a href="{$article.next.url}" class="next_detail">下一篇:{$article.next.title}<b class="icon icon_arrow_right"></b></a>
<!--{/if}--> 展开
$article['pre'] = $modArticle->getPre($this->id);
$article['next'] = $modArticle->getNext($this->id);
$url = array($modArticle, 'getUrl', $this->id);
$article['attach_num'] = $modAttach->getAttachNum($this->id);
$pageInfo = new Ext_Page($url, $article['attach_num'], $this->page,
我修改成这样
<?php
$cates = get_the_cate();
$cateIDS = array();
foreach ($cates as $cate) {
array_push($cateIDS, $cate->term_id);
}
$cateIDS = implode(",", $cateIDS);
?>
<?php
if (get_previous_article($cateIDS)) { previous_article_url('上一篇:
%url','%article_title',true);} else { echo "已是最后文章";} ?>
<?php
if (get_next_article($categoryIDS)) { next_article_url('上一篇:
%url','%article_title',true);} else { echo "已是最新文章";} ?>
不知道这样改对不对
在HTML里面表现为这样
<!--{if $article.pre}-->
<a href="{$article.pre.url}" class="prev_detail"><b class="icon icon_arrow_left"></b>上一篇:{$article.pre.title}</a>
<!--{/if}-->
<!--{if $article.next}-->
<a href="{$article.next.url}" class="next_detail">下一篇:{$article.next.title}<b class="icon icon_arrow_right"></b></a>
<!--{/if}--> 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询