码迷,mamicode.com
首页 > 编程语言 > 详细

espcms内容页上下篇按后台手动排序号

时间:2015-12-04 20:53:26      阅读:169      评论:0      收藏:0      [点我收藏+]

标签:

模板文件:

{%get name=plist class="did":$read.did,pid:$read.pid%}
<li class="fl">{%if $read.ctitle!=‘‘%}上一篇:<a class="infolist2" title="{%$read.title%}" href="{%$read.link%}">{%$read.ctitle%}</a>{%/if%}</li>
{%/get%}
{%get name=plist class="did":$read.did,pid:$read.pid,class:1%}
<li class="fr">{%if $read.ctitle!=‘‘%}下一篇:<a class="infolist2" title="{%$read.title%}" href="{%$read.link%}">{%$read.ctitle%}</a>{%/if%}</li>
{%/get%}

 

修改php文件:
/interface/lib_plist.php

增加17行
$pid = intval($para[‘pid‘]);//print($pid); 修改28行: if ($class) { $sql = "SELECT * FROM $db_table WHERE isclass=1 AND tid = $read[tid] AND pid > $pid ORDER BY pid ASC LIMIT 0,1"; } else { $sql = "SELECT * FROM $db_table WHERE isclass=1 AND tid = $read[tid] AND pid < $pid ORDER BY pid DESC LIMIT 0,1"; }

 

/interface/lib_plist.php

<?php



class lib_plist extends connector {

    function lib_plist() {
        $this->softbase();
        parent::start_pagetemplate();
        $this->pagetemplate->libfile = true;
    }
    function call_plist($lng, $para, $filename = ‘plist‘, $outHTML = null) {
        $para = $this->fun->array_getvalue($para);
        $lngpack = $lng ? $lng : $this->CON[‘is_lancode‘];
        $lng = ($lng == ‘big5‘) ? $this->CON[‘is_lancode‘] : $lng;
        include admin_ROOT . ‘datacache/‘ . $lng . ‘_pack.php‘;
        $did = intval($para[‘did‘]);//print($did);
        $pid = intval($para[‘pid‘]);//print($pid);
        if (empty($did)) {
            return false;
        }
        $class = intval($para[‘class‘]);
        $class = empty($class) ? 0 : $class;
        $db_table = db_prefix . ‘document‘;
        $read = $this->get_documentview($did);
        if (!$read[‘tid‘]) {
            return false;
        }
        if ($class) {
            $sql = "SELECT * FROM $db_table WHERE isclass=1 AND tid = $read[tid] AND pid > $pid ORDER BY pid ASC LIMIT 0,1";
        } else {
            $sql = "SELECT * FROM $db_table WHERE isclass=1 AND tid = $read[tid] AND pid < $pid ORDER BY pid DESC LIMIT 0,1";
        }
        $rslist = $this->db->fetch_first($sql);
        if (is_array($rslist)) {
            $typeread = $this->get_type($rslist[‘tid‘]);
            $rslist[‘typename‘] = $typeread[‘typename‘];
            $rslist[‘typelink‘] = $this->get_link(‘type‘, $typeread, $lngpack);
            $rslist[‘pageclass‘] = $typeread[‘pageclass‘];

            $rslist[‘link‘] = $this->get_link(‘doc‘, $rslist, $lngpack);
            $rslist[‘buylink‘] = $this->get_link(‘buylink‘, $rslist, $lngpack);
            $rsList[‘enqlink‘] = $this->get_link(‘enqlink‘, $rsList, $lngpack);
            $rslist[‘ctitle‘] = empty($rslist[‘color‘]) ? $rslist[‘title‘] : "<font color=‘" . $rslist[‘color‘] . "‘>" . $rslist[‘title‘] . "</font>";
        }
        $this->pagetemplate->assign(‘read‘, $rslist);
        $this->pagetemplate->assign(‘lng‘, $lng);
        $this->pagetemplate->assign(‘lngpack‘, $LANPACK);
        if (!empty($outHTML)) {
            $output = $this->pagetemplate->fetch(null, null, $outHTML);
        } else {
            $output = $this->pagetemplate->fetch($lng . ‘/lib/‘ . $filename);
        }
        return $output;
    }

}

 

espcms内容页上下篇按后台手动排序号

标签:

原文地址:http://www.cnblogs.com/woodk/p/5020288.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!