上下页
php
Tp5
PHP代码
# 上一页 page
$page= $news_model->where('status',1)->order('id','asc')->where('sort_id',$sort_id)->where('id', '>', $id)->find();
# 下一页 next
$next=$news_model->where('status',1)->order('id','desc')->where('sort_id',$sort_id)->where('id', '<', $id)->find();
HTML代码
<div class="turning wow animated fadeInUp">
<div class="turning_le">
{empty name="$page.id"}
<a href="JavaScript::">
<span>无</span>
</a>
{/empty}
{notempty name="$page.id"}
<a href="{:url('/index/news_detail')}?id={$page.id}">
<span>< 上一页</span>
</a>
{/notempty}
</div>
<div class="turning_ri">
{empty name="$next.id"}
<a href="JavaScript::">
<span>无</span>
</a>
{/empty}
{notempty name="$next.id"}
<a href="{:url('/index/news_detail')}?id={$next.id}">
<span>下一页></span>
</a>
{/notempty}
</div>
</div>