首页 > 请问typecho模板如何调用某一文章分类下面的文章呢?

请问typecho模板如何调用某一文章分类下面的文章呢?

我按照官方文档:

http://docs.typecho.org/themes/category-posts

的说明,调用第五个分类的内容,但是输出的结果不对。

代码如下:

<?php $this->widget('Widget_Archive@myCustomCategory', 'type=category', 'mid=5')->to($categoryPosts); ?>
<?php while($categoryPosts->next()): ?>
    <li><a href="<?php $categoryPosts->permalink(); ?>" title="<?php $categoryPosts->commentsNum('%d Comments'); ?>"><?php $categoryPosts->title(); ?></a></li>
<?php endwhile; ?>

请问问题出在哪里?

我用的1.0版。


已自解决。

<?php $this->widget('Widget_Archive@index', 'type=category', 'mid=5')->to($categoryPosts); ?>
<?php while($categoryPosts->next()): ?>
    <li><a href="<?php $categoryPosts->permalink(); ?>" title="<?php $categoryPosts->commentsNum('%d Comments'); ?>"><?php $categoryPosts->title(); ?></a></li>
<?php endwhile; ?>

widget('Widget_Archive@myCustomCategory', 'type=category', 'mid=5')

改为

widget('Widget_Archive@index', 'type=category', 'mid=5')

@ 后面是为了区分多次调用。


Thanks

【热门文章】
【热门文章】