上一篇下一篇之终极必杀(适用于任何网站环境)
<?php
$preurl = $navinfor['id']-1;
$neturl = $navinfor['id']+1;
$preurl_f=$empire->fetch1("select title,titleurl from phome_ecms_{$navinfor['classid']} where id='$preurl'");
$neturl_f=$empire->fetch1("select title,titleurl from phome_ecms_{$navinfor['classid']} where id='$neturl'");
if (empty($preurl_f['titlepic'])){ $prepic = 'https://cae.letogther.cn/service/images/background.jpg_img380120.png'; }
else{ $prepic = $preurl_f['titlepic']."_img380120.png"; }
if (empty($neturl_f['titlepic'])){ $netpic = 'https://cae.letogther.cn/service/images/background.jpg_img380120.png'; }
else{ $netpic = $neturl_f['titlepic']."_img380120.png"; }
?>
以下这两条代码需要配合上边的PHP代码使用,无法单独使用!
PHP高效上一篇:
<div class="prev-post">
<a href="<?=$preurl_f[titleurl]?>" data-title="<?=$preurl_f[title]?>" class="prev-a prev has-background" alt="<?=$preurl_f[title]?>"><span>上一篇</span>
<div>
PHP高效下一篇:
<div class="next-post">
<a href="<?=$neturl_f[titleurl]?>" data-title="<?=$neturl_f[title]?>" class="next-a next has-background" alt="<?=$neturl_f[title]?>"><span>下一篇</span>
<div>
<a href="[!--news.url--]e/public/GotoNext?classid=[!--classid--]&id=[!--id--]&enews=pre">上一篇</a> 动态调用上一篇链接
<a href="[!--news.url--]e/public/GotoNext?classid=[!--classid--]&id=[!--id--]&enews=next">下一篇</a> 动态调用下一篇链接
灵动标签调用亲测没问题,记住如果写样式的话用单引号不然会报错。
[e:loop={'selfinfo',1,0,0,'id<'.$navinfor[id].'','id desc'}]
<a data-type="mip" data-title="<?=$bqr[title]?>" href="<?php
echo $bqsr[titleurl];
$pre='true';
?>">上一篇:<?=$bqr[title]?>
</a>
[/e:loop]
<?php
if(empty($pre)){
echo "上一篇:很抱歉没有了";
}
?>
[e:loop={'selfinfo',1,0,0,'id>'.$navinfor[id].'','id asc'}]
<a data-type="mip" data-title="<?=$bqr[title]?>" href="<?php
echo $bqsr[titleurl];
$next='true';
?>">下一篇:<?=$bqr[title]?>
</a>
[/e:loop]
<?php
if(empty($next)){
echo "下一篇:很抱歉没有了";
}
?>
当前目录:帝国CMS教程
帝国cms上一篇下一篇之终极必杀(适用于任何网站环境)
帝国CMS教程 2025-04-03 15:34:57