discuz!怎樣實現主題列表頁顯示文章本文摘要?非預覽功能。

來源:互聯網
上載者:User
如那樣顯示對應的主題的本文前200字。但對應的模版檔案裡好像沒有“內容”的變數啊,求教


回複討論(解決方案)


重點看紅色地區的代碼,應該會對你有用,這個是直接獲得該文章的內容,


重點看紅色地區的代碼,應該會對你有用,這個是直接獲得該文章的內容,



這段代碼在那個模版檔案裡的?

不建議在模版檔案中執行查詢
開啟後台檔案\source\module\forum\forum_forumdisplay.php

//搜尋foreach($threadlist as $thread) {//在其上面添加foreach($threadlist as $v){$tids[]=$v['tid'];}$strtids=join(',',$tids);$msginfos=DB::fetch_all("SELECT tid,message FROM %t WHERE tid IN($strtids)",array('forum_post'));if(!function_exists('messagecutstr')){require_once libfile('function/post');}foreach($msginfos as $v){$cutmsginfos[$v['tid']]=messagecutstr($v['message'],200);}//在其下面添加$thread['cutmsg']=$cutmsginfos[$thread['tid']];

前台用$thread['cutmsg']就可以擷取
開啟模版檔案\template\default\forum\forumdisplay_list.htm
$thread['cutmsg']


樣子如所示,樣式自己調


不建議在模版檔案中執行查詢
開啟後台檔案\source\module\forum\forum_forumdisplay.php
謝謝你的答案,很耐心很詳細。衷心感謝。

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.