Typecho常用调用变量

作者:欧阳 发布时间:2012年10月03日 阅读: 2,521 分类:学习笔记

站点名称

<?php $this->options->title(); ?>

域名地址

<?php $this->options->siteUrl(); ?>

后台地址

<?php $this->options->adminUrl(); ?>

完整路径标题,比如 文章 站点

<?php $this->archiveTitle(' &raquo; ', '', ' - '); ?><?php $this->options->title(); ?>

站点说明

<?php $this->options->description(); ?>

模版文件夹地址

<?php $this->options->themeUrl(); ?>

作者名字

<?php $this->author(); ?>

当前登陆用户名字

<?php $this->user->screenName(); ?>

退出链接

<a href="<?php $this->options->logoutUrl(); ?>"><?php _e('退出'); ?></a>

rss地址

<?php $this->options->feedUrl(); ?>

作者头像

<?php $this->author->gravatar('200') ?>
参数说明
此函数是完整 img 标签,200代表长和宽

该文作者全部文章列表链接

<?php $this->author->permalink(); ?>

该文作者个人主页链接

<?php $this->author->url(); ?>

该文作者的邮箱地址

<?php $this->author->mail(); ?>

rss评论

<?php $this->options->commentsFeedUrl(); ?>

引用模版文件夹内php文件

<?php $this->need('*.php'); ?>
参数说明
可以使用相对路径获取上级目录php文件

纯文字分类名称,不带链接

<?php $this->category(',', false); ?>

各种列表页面标题,如标签分类

<?php $this->archiveTitle(' &nbsp; ', '', ''); ?>

文章或页面,标题

<?php $this->title() ?>

文章上一篇

<?php $this->theNext(); ?>

文章下一篇

<?php $this->thePrev(); ?>

文章或页面,链接

<?php $this->permalink() ?>

文章或页面,发表时间

<?php $this->date(); ?>

文章或页面,评论数目

<?php $this->commentsNum('No Comments', '1 Comment', '%d Comments'); ?>

文章或页面,内容,括号里有内容,如果加入了more就会自动生成链接

<?php $this->content('阅读剩余部分...'); ?>

文章所在分类,链接形式

<?php $this->category(','); ?>

文章,所加标签

<?php $this->tags(', ', true, 'none'); ?>

列表页分页

<?php $this->pageNav(); ?>

隐藏head区域的程序版本和模版名称

<?php $this->header("generator=&template="); ?>

登陆与未登录用户展示不同内容

<?php if($this->user->hasLogin()): ?>

登陆可见

<?php else: ?>

未登录和登陆均可见

<?php endif; ?>

来源:网络

如果您还有什么疑惑或建议,欢迎在下方评论区继续讨论。
如果您觉得本文还不错,欢迎分享/打赏本文。当然,如果你无视它,也不会影响你的阅读。再次表示欢迎和感谢!

标签: typecho

添加新评论 »