批改PHPCMS V9相關文章、專題listorder、order排序功能的方法

來源:互聯網
上載者:User
修改PHPCMS V9相關文章、專題listorder、order排序功能的方法

phpcms v9內建的相關文章、專題等模組不支援order排序,調用的相關文章、專題預設為升序,這樣就造成了一個問題,調出來的相關文章是最早的文章,沒有時效性。我們只能通過修改程式檔案,只需簡單修改一個檔案,就能達到我們的需求。

修改相關文章排序的方法:

開啟根目錄下的phpcms/modules/content/classes/content_tag.class.php,找到

$r = $this->db->select($sql2, '*', $limit, '','','id');

修改為:

$r = $this->db->select($sql2, '*', $limit, $order,'','','id');

PC標籤格式如下:

{pc:content action="relation" relation="$relation" id="$id" catid="$catid" num="5" order="inputtime DESC" keywords="$rs[keywords]"}

按發布時間排序:order="inputtime DESC"

按ID降序排序:order="id DESC"


修改相關專題排序的方法:

開啟根目錄下的phpcms/modules/special/classes/special_tag.class.php,找到

$listorder = array('`id` ASC', '`id` DESC', '`listorder` ASC, `id` DESC', '`listorder` DESC, `id` DESC');

修改為:

$listorder = array('`id` ASC', '`id` DESC', '`listorder` ASC', '`listorder` DESC');

PC標籤格式如下:

【因為:pc標籤裡

order="listorder DESC" 和 listorder="3" 有區別

$listorder = array('`id` ASC', '`id` DESC', '`listorder` ASC', '`listorder` DESC');
分別是 0 1 2 3 四個選項
那麼:
listorder="0" 等於 order="id ASC"
listorder="1" 等於 order="id DESC"
listorder="2" 等於 order="listorder ASC"
listorder="3" 等於 order="listorder DESC"】

{pc:special action="content_list" specialid="$id" typeid="$t[typeid]" listorder="3" num="9"}

按發布時間排序:order="inputtime DESC"

按ID降序排序:order="id DESC"






  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.