Espcmsコンテンツページ上下編バックグラウンド別手動ソート番号

8569 ワード

テンプレートファイル:
{%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 }