我在后台创建了一张独立页面,并配了自定义模板。因为页面中需要遍历所有文章(包括:标题、作者、发布时间、内容、标签)请问我该如何写?谢谢!
补充:如果在模版中使用:<?php while($this->next()): ?>...<?php endwhile; ?>
只能显示这个独立页面的文章内容,并不是整站所有的文章。求高手指教。
自己读数据库吧。
$db = Typecho_Db::get();
$select = $db->select()->from('table.contents')
->where('type = ?', 'post')
->where('table.contents.status = ?', 'publish')
->where('table.contents.created < ?', time())
->order('table.contents.created', Typecho_Db::SORT_DESC);
$posts = $db->fetchAll($select);