• 技术文章 >php教程 >php手册

    phpcms2008:phpcms2008添加上一篇下一篇的功能

    2016-06-21 08:51:34原创409
    第一步:修改show.php
    在代码
    if(!$C['defaultchargepoint'] && !$r['readpoint'])
    前面增加代码
    //
    //上一篇文章
    $more_pre = $db->get_one("SELECT title,url FROM `".DB_PRE."content` WHERE `contentid`<$contentid and `catid`='{$r['catid']}' order by contentid desc limit 0,1");
    if(empty($more_pre)) {
    $more_pre['title']='没有了';
    $more_pre['url']='';
    }
    //下一篇文章
    $more_next = $db->get_one("SELECT title,url FROM `".DB_PRE."content` WHERE `contentid`>$contentid and `catid`='{$r['catid']}' order by contentid asc limit 0,1");
    if(empty($more_next)) {
    $more_next['title']='没有了';
    $more_next['url']='';
    }
    //

    第二步:修改include/html.class.php中的show函数
    在代码
    if(strpos($content, '[page]') !== false)
    前增加代码:
    //
    global $db;
    //上一篇文章
    $more_pre = $db->get_one("SELECT title,url FROM `".DB_PRE."content` WHERE `contentid`<$contentid and `catid`='$catid' order by contentid desc limit 0,1");
    if(empty($more_pre)) {
    $more_pre['title']='没有了';
    $more_pre['url']='';
    }
    //下一篇文章
    $more_next = $db->get_one("SELECT title,url FROM `".DB_PRE."content` WHERE `contentid`>$contentid and `catid`='$catid' order by contentid asc limit 0,1");
    if(empty($more_next)) {
    $more_next['title']='没有了';
    $more_next['url']='';
    }
    //

    第三步:在模板目录/phpcms/show.html文件中您认为合适的位置添加

    第四步:在您的CSS样式文件中添加
    /***上一篇下一篇文章链接(fke.la)***/
    .moreArticle{
    margin:5px 0px;width:100%;
    font-size:12px;clear:both; 本文链接http://www.cxybl.com/html/wlbc/Php/20120627/31129.html



    声明:本文原创发布php中文网,转载请注明出处,感谢您的尊重!如有疑问,请联系admin@php.cn处理
    专题推荐:more contentid title pre gt
    上一篇:关键路径:php实现图的邻接表,关键路径,拓朴排序 下一篇:平衡二叉树:php实现平衡二叉树(avl树)
    大前端线上培训班

    相关文章推荐

    • 异步加载技术实现瀑布流效果,异步加载技术瀑布• PHP 自定义函数:清除页面所有js,html,css代码• BS模式中用php创建socket 无权限的解决办法• Azure拥抱PHP是好是坏?从另一个角度看微软开源策略• PHP 魔术方法总结

    全部评论我要评论

  • 取消发布评论发送
  • 1/1

    PHP中文网