Home  >  Article  >  Backend Development  >  Typecho首页如何调用指定分类下的文章

Typecho首页如何调用指定分类下的文章

WBOY
WBOYOriginal
2016-06-06 20:29:381711browse

提出问题:我希望首页的文章列表输出指定分类下的文章(被指定的分类输出,没被指定的分类不输出,另外是否能指定多个分类?),应该如何操作?
个人水平:简单的html(5没学)和css(3没学),PHP和Javascript没学。


一些描述:
我已经在sf的typecho区搜索过了,然后发现了这篇文章:《TYPECHO如果想输出某个分类的文章列表,这个列表需要带有文章图片该怎么操作》。

我按照答案,把<?php $this->widget('Widget_Archive@index', 'pageSize=6&type=category', 'mid=12')->to($categoryPosts); ?>复制进“index.php”文件中,放置在<?php while($categoryPosts->next()): ?>之上,然后修改mid,打开首页并没有我想要的效果。

另外我也在官方文档中看过一篇关于“调用某一分类下的文章”的文档,官方说这样调用:<?php $this->widget('Widget_Archive@myCustomCategory', 'type=category', 'mid=1')->to($categoryPosts); ?>,然后操作“$categoryPosts”的变量,关于这个变量我也不知道如何操作= =

回复内容:

提出问题:我希望首页的文章列表输出指定分类下的文章(被指定的分类输出,没被指定的分类不输出,另外是否能指定多个分类?),应该如何操作?
个人水平:简单的html(5没学)和css(3没学),PHP和Javascript没学。


一些描述:
我已经在sf的typecho区搜索过了,然后发现了这篇文章:《TYPECHO如果想输出某个分类的文章列表,这个列表需要带有文章图片该怎么操作》。

我按照答案,把<?php $this->widget('Widget_Archive@index', 'pageSize=6&type=category', 'mid=12')->to($categoryPosts); ?>复制进“index.php”文件中,放置在<?php while($categoryPosts->next()): ?>之上,然后修改mid,打开首页并没有我想要的效果。

另外我也在官方文档中看过一篇关于“调用某一分类下的文章”的文档,官方说这样调用:<?php $this->widget('Widget_Archive@myCustomCategory', 'type=category', 'mid=1')->to($categoryPosts); ?>,然后操作“$categoryPosts”的变量,关于这个变量我也不知道如何操作= =

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn