在首頁或頻道頁展示帶縮略圖的新聞列表,包含標題、摘要、圖片、發布時間等元素,提升內容吸引力與點擊率。
{if $DT[page_news]}
<!--{tag("moduleid=21&length=16&condition=status=3 and level=3 and thumb<>''&pagesize=1&target=_blank&order=addtime desc&width=100&height=80&cols=1&template=thumb-table")}-->
{/if}
<!--{php $tags=tag("moduleid=7&condition=status=3 and thumb!=''&length=30 and level>0&areaid=$cityid&pagesize=1&datetype=2&order=addtime desc&target=_blank&template=null");}-->
{loop $tags $i $t}
<a href="{$t[linkurl]}" rel="external nofollow" target="_blank">
<span><img src="{$t[thumb]}" width="96" height="66" alt="" ></span>
<strong>{$t[title]}</strong>
<small>{dsubstr($t[introduce],76)}... <em>[詳細]</em></small>
</a>
{/loop}
| 參數 | 說明 |
|---|---|
moduleid | 模組 ID(7=文章,21=資訊等) |
condition | SQL WHERE 條件:status=3通過審核,thumb!=''有縮略圖,level>0推薦等級 |
areaid | 地區 ID 篩選($cityid 為當前城市) |
pagesize | 顯示筆數 |
datetype=2 | 時間範圍:今日 |
order=addtime desc | 按發布時間倒序 |
width/height | 縮略圖尺寸(自動裁剪) |
template | 子模板名稱(null 表示不使用) |
$t 主要欄位linkurl:文章連結thumb:縮略圖路徑title:標題introduce:摘要/導語addtime:發布時間戳.news-thumb-list a { display: block; padding: 10px; border-bottom: 1px solid #eee; }
.news-thumb-list img { float: left; margin-right: 10px; border-radius: 4px; }
.news-thumb-list strong { display: block; font-size: 14px; color: #333; margin-bottom: 5px; }
.news-thumb-list small { color: #999; font-size: 12px; line-height: 1.5; }
.news-thumb-list em { color: #0066CC; }
loading="lazy" 屬性srcset 提供多尺寸版本{$t[thumb] ? $t[thumb] : 'default-thumb.jpg'}cache=300 參數減少資料庫查詢此圖文列表模組是內容型網站的核心組件,合理配置可顯著提升用戶停留時間與轉化率。