这些都是Typecho常用的标签函数,整理在此处主要是方便首次修改Typecho代码或者不想去Typecho文档站点 - Typecho Docs查看官方文档。当然,如果要设计主题模板,或者开发插件等,还是的查官方文档。
一、站点相关
1. 站点名称:<?php $this->options->title(); ?>
2. 站点URL:<?php $this->options ->siteUrl(); ?>
3. 站点说明:<?php $this->options->description() ?>
4. 站点后台URL:<?php $this->options->adminUrl(); ?>
5. 站点RSS:<?php $this->options->feedUrl(); ?>
6. 站点首页判断:
<?php if ($this->is('index')): ?>
//首页输出内容
<?php else: ?>
//不是首页输出内容
<?php endif; ?>
7. 整站数据统计输出:
<;?php Typecho_Widget::widget('Widget_Stat')->to($stat); ?>
文章总数:<;?php $stat->publishedPostsNum() ?>篇
分类总数:<?php $stat->categoriesNum() ?>个
评论总数:<?php $stat->publishedCommentsNum() ?>条
页面总数:<?php $stat->publishedPagesNum() ?>个
当前作者的文章总数:<?php $stat->myPublishedPostsNum() ?> 篇
二、文章相关
1. 文章或页面的标题:<?php $this->title() ?>
2. 文章或页面的URL:<?php $this->permalink() ?>
3. 文章或页面的发表时间:<?php $this->date(); ?>
4. 文章或页面的访问次数:<?php Views_Plugin::theViews('被访问 ', '次'); ?>
5. 文章上一篇:<?php $this->theNext(); ?>
6. 文章下一篇:<?php $this->thePrev(); ?>
7. 文章分类名:<?php $categorys->name();?>
8. 截取文章摘要,200字数限制:<?php $this->excerpt(200, '.. .'); ?>
9. 作者:<?php $this->author(); ?>
10. 作者的邮箱地址:<?php $this->author->mail(); ?>
11. 文章作者URL:<?php $this->author->url(); ?>
12. 作者全部文章列表URL:<?php $this->author->permalink(); ?>
13. 最后更新:<?php echo date(_mt("Y 年 m 月 d 日 h : i A") , $this->modified + $this->options->timezone - idate("Z"));?>
三、参数说明
- 获取已发布的文章数目:publishedPostsNum
- 获取待审核的文章数目:waitingPostsNum
- 获取草稿文章数目:draftPostsNum
- 获取当前用户已发布的文章数目:myPublishedPostsNum
- 获取当前用户待审核文章数目:myWaitingPostsNum
- 获取当前用户草稿文章数目:myDraftPostsNum
- 获取当前用户已发布的文章数目:currentPublishedPostsNum
- 获取当前用户待审核文章数目:currentWaitingPostsNum
- 获取当前用户草稿文章数目:currentDraftPostsNum
- 获取已发布页面数目:publishedPagesNum
- 获取草稿页面数目:draftPagesNum
- 获取当前显示的评论数目:publishedCommentsNum
- 获取当前待审核的评论数目:waitingCommentsNum
- 获取当前垃圾评论数目:spamCommentsNum
- 获取当前用户显示的评论数目:myPublishedCommentsNum
- 获取当前用户显示的评论数目:myWaitingCommentsNum
- 获取当前用户显示的评论数目:mySpamCommentsNum
- 获取当前文章的评论数目:currentCommentsNum
- 获取当前文章显示的评论数目:currentPublishedCommentsNum
- 获取当前文章显示的评论数目:currentWaitingCommentsNum
- 获取当前文章显示的评论数目:currentSpamCommentsNum
- 获取分类数目:categoriesNum
四、其他
1. 页面标题 - 站点名称:<?php $this->archiveTitle('','',' - '); ?><?php $this->options->title(); ?>
2. 主题模板URL:<?php $this->options->themeUrl(); ?>
3. PHP引用:<?php $this->need('*.php'); ?> 可以使用相对路径获取上级目录php文件
4. 调用自定义字段:<?php $this->fields->fieldName ?>
5. 当前登录用户:<?php $this->user->screenName(); ?>
6. 退出:<a href="<?php $this->options->logoutUrl(); ?>"><?php _e('退出'); ?></a>
7. 完整路径标题:<?php $this->archiveTitle(' » ', < span class="string">'', ' | '); ?><?php $this ->options->title(); ?>
注:以上可适用于Typecho代码环境:Typecho v1.1 (17.10.30)
这个资源储存是什么系统啊
zfile,GitHub上搜索