第5章节,列表页面,列表文章循环(typecho主题模板开发实战)
前言
前面,已经通过首页熟悉了,列表循环
现在如法炮制即可
为了方便,我写在(archive.php)页面,如果自己想精致一点,请按照第1章节的目录结构写
[catle gid=155]
以下是列表页的大概结构
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<?php $this->need('header.php'); ?>
//标题
<?php $this->archiveTitle([
'category' => _t('分类 %s 下的文章'),
'search' => _t('包含关键字 %s 的文章'),
'tag' => _t('标签 %s 下的文章'),
'author' => _t('%s 发布的文章')
], '', ''); ?>
和首页一样循环文章列表
<?php while ($this->next()): ?>
文章标题:<?php $this->title() ?>
文章链接:<?php $this->permalink() ?>
文章简介:<?php $this->content('- 阅读剩余部分 -'); ?>
作者:<?php $this->author(); ?>
作者链接:<?php $this->author->permalink(); ?>
文章发布时间:<?php $this->date(); ?>
文章所属分类:<?php $this->category(','); ?>
文章有多少条评论:<?php $this->commentsNum('评论', '1 条评论', '%d 条评论'); ?>
<?php endwhile; ?>
//分页
<?php $this->pageNav('« 前一页', '后一页 »'); ?>
<?php $this->need('footer.php'); ?>
声明:本站原创文章文字版权归本站所有,转载务必注明作者和出处;本站转载文章仅仅代表原作者观点,不代表本站立场,图文版权归原作者所有。如有侵权,请联系我们删除。