我看几乎每个用typecho的人的博客都有类似的文章,我因为懒,所以一直就没有写,今天特别无聊,就写写吧,争取写的全点。

站点动态标题

https://www.veimoz.com/archiveTitle(array(
'category'=>_t('分类 %s 下的文章'),
'search'=>_t('包含关键字 %s 的文章'),
'tag' =>_t('标签 %s 下的文章'),
'author'=>_t('%s 的主页')
), '', ' - '); ?>

站点地址,名称与描述

https://www.veimoz.com/options->siteUrl(); ?>//站点地址
https://www.veimoz.com/options->title(); ?>//名称
https://www.veimoz.com/options->description() ?>//描述

index.php文章循环输出

have()): ?>//判断文章存在与否
next()): ?>//开始循环
https://www.veimoz.com/title() ?>//文章标题和超链接
https://www.veimoz.com/author(); ?>//作者名称和超链接
https://www.veimoz.com/date('F j, Y'); ?>//文章发布时间
https://www.veimoz.com/category(','); ?>//文章分类
https://www.veimoz.com/commentsNum('%d Comments'); ?>//评论数量
https://www.veimoz.com/content('Continue Reading...'); ?>//阅读全文more语法截取缩略内容(可改为https://www.veimoz.com/excerpt(140,'....'); ?>自动截取前140个字符,根据需要也可以改成 https://www.veimoz.com/summary(); ?新版功能,自动输出内容中第一个块级元素中的内容>)
//循环结束
暂无与之相关文章//判断结束

翻页代码

https://www.veimoz.com/pageNav('上一页', '下一页', '5', '……'); ?>//显示多个页码的
https://www.veimoz.com/pageLink('下一页','next'); ?>https://www.veimoz.com/pageLink('上一页'); ?>//只显示上一页下一页

页码显示

当前页码:_currentPage>1) echo $this->_currentPage;  else echo 1;?>总页码:getTotal() / $this->parameter->pageSize); ?>

文章全文显示

https://www.veimoz.com/content(); ?>

登陆判断

user->hasLogin()):?> 登陆才可以看到这里的内容

文章作者名称与主页地址

https://www.veimoz.com/author(); ?>

文章最后编辑时间

modified + Typecho_Widget::widget('Widget_Options')->timezone); ?>

当前文章id

https://www.veimoz.com/cid(); ?>

文章中的上一篇和下一篇

上一篇: https://www.veimoz.com/thePrev('%s','没有了'); ?>下一篇: https://www.veimoz.com/theNext('%s','没有了'); ?>

文章标签

https://www.veimoz.com/tags(', ', true, 'none'); ?>说明:(', ', true, 'none')第一个单引号间的逗号代表标签与标签的间隔用逗号隔开,true是标签以超链接形式输出,none为该文章没有标签时显示的提示信息。

用户昵称

https://www.veimoz.com/user->screenName(); ?>

后台地址与登陆地址

https://www.veimoz.com/options->adminUrl(); ?>//后台地址
https://www.veimoz.com/options->adminUrl('login.php'); ?>//登陆地址

分类描述

getDescription(); ?>

标签相关文章

https://www.veimoz.com/related(5)->to($relatedPosts); ?>

调用某分类文章,pageSize是数量,mid是分类号:

https://www.veimoz.com/widget('Widget_Archive@index', 'pageSize=6&type=category', 'mid=47′)
->parse('
  • {title}
  • '); ?>

    首行缩进问题,加入css实现

    .post-content p{ 
    text-indent: 2em; /*em是相对单位,2em即现在一个字大小的两倍*/ 
    } 

    最新文章

    https://www.veimoz.com/widget('Widget_Contents_Post_Recent')->to($post); ?>next()): ?>permalink(); ?>” title=https://www.veimoz.com/”title(); ?>”>title(25, '…'); ?>

    神奇的is语法

    is('post')) : ?> 这里就是内容了
    typecho可以使用is语法判断很多东西,比如
    $this->is('index');
    $this->is('archive');
    $this->is('single');
    $this->is('page');
    $this->is('post');
    $this->is('category');
    $this->is('tag');
    甚至是
    $this->is('category', 'default');
    $this->is('page', 'start');
    $this->is('post', 1);
    

    判断为当前页的第几篇文章,并单独输出内容

    sequence == 0): ?>//需要的插入
    
    TAGS:typecho
    !如链接失效请在下方留言。本站所有资源均来源于网络,版权属于原作者!仅供学习参考,本站不对您的使用负任何责任。如果有侵权之处请第一时间联系我们删除,敬请谅解!