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


    模板文件:

    {%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行:
    //先按pid排序查询,如果都相同则按did查询。先按pid排序,如果都相同则按did排序
    if ($class) {
      $sql = "SELECT * FROM $db_table WHERE isclass=1 AND tid = $read[tid] AND (pid > $pid or (pid = $pid and did > $did)) ORDER BY pid ASC, did ASC LIMIT 0,1";
    } else {
      $sql = "SELECT * FROM $db_table WHERE isclass=1 AND tid = $read[tid] AND (pid < $pid or (pid = $pid and did < $did)) ORDER BY pid DESC, did DESC LIMIT 0,1";
    }

    /interface/lib_plist.php

     1 <?php
     2 
     3 
     4 
     5 class lib_plist extends connector {
     6 
     7     function lib_plist() {
     8         $this->softbase();
     9         parent::start_pagetemplate();
    10         $this->pagetemplate->libfile = true;
    11     }
    12     function call_plist($lng, $para, $filename = 'plist', $outHTML = null) {
    13         $para = $this->fun->array_getvalue($para);
    14         $lngpack = $lng ? $lng : $this->CON['is_lancode'];
    15         $lng = ($lng == 'big5') ? $this->CON['is_lancode'] : $lng;
    16         include admin_ROOT . 'datacache/' . $lng . '_pack.php';
    17         $did = intval($para['did']);//print($did);
    18         $pid = intval($para['pid']);//print($pid);
    19         if (empty($did)) {
    20             return false;
    21         }
    22         $class = intval($para['class']);
    23         $class = empty($class) ? 0 : $class;
    24         $db_table = db_prefix . 'document';
    25         $read = $this->get_documentview($did);
    26         if (!$read['tid']) {
    27             return false;
    28         }
    29         //先按pid排序查询,如果都相同则按did查询。先按pid排序,如果都相同则按did排序
    30         if ($class) {
    31             $sql = "SELECT * FROM $db_table WHERE isclass=1 AND tid = $read[tid] AND (pid > $pid or (pid = $pid and did > $did)) ORDER BY pid ASC, did ASC LIMIT 0,1";
    32         } else {
    33             $sql = "SELECT * FROM $db_table WHERE isclass=1 AND tid = $read[tid] AND (pid < $pid or (pid = $pid and did < $did)) ORDER BY pid DESC, did DESC LIMIT 0,1";
    34         }
    35         $rslist = $this->db->fetch_first($sql);
    36         if (is_array($rslist)) {
    37             $typeread = $this->get_type($rslist['tid']);
    38             $rslist['typename'] = $typeread['typename'];
    39             $rslist['typelink'] = $this->get_link('type', $typeread, $lngpack);
    40             $rslist['pageclass'] = $typeread['pageclass'];
    41 
    42             $rslist['link'] = $this->get_link('doc', $rslist, $lngpack);
    43             $rslist['buylink'] = $this->get_link('buylink', $rslist, $lngpack);
    44             $rsList['enqlink'] = $this->get_link('enqlink', $rsList, $lngpack);
    45             $rslist['ctitle'] = empty($rslist['color']) ? $rslist['title'] : "<font color='" . $rslist['color'] . "'>" . $rslist['title'] . "</font>";
    46         }
    47         $this->pagetemplate->assign('read', $rslist);
    48         $this->pagetemplate->assign('lng', $lng);
    49         $this->pagetemplate->assign('lngpack', $LANPACK);
    50         if (!empty($outHTML)) {
    51             $output = $this->pagetemplate->fetch(null, null, $outHTML);
    52         } else {
    53             $output = $this->pagetemplate->fetch($lng . '/lib/' . $filename);
    54         }
    55         return $output;
    56     }
    57 
    58 }

  • 相关阅读:
    Ant简单工程的构建
    [转载] 无所不能的“蚂蚁”--Ant
    引体向上高级技巧:停顿式引体向上!
    引体向上腰酸?下背痛?你做对了吗?
    划船训练常见错误:含胸驼背肩胛骨活动不足
    引体向上
    仰卧飞鸟:仰卧哑铃飞鸟图解教程
    蝶机夹胸:蝴蝶机夹胸夹胸/飞鸟动作图解教程
    史密斯卧推:杠铃史密斯下斜卧推、上斜机卧推、平板卧推动作图解
    练胸秘籍:胸肌训练5大重点
  • 原文地址:https://www.cnblogs.com/woodk/p/5020288.html
Copyright © 2020-2023  润新知