Typecho个性化修改

每天只能折腾一点点,网站模版和个性化。
先记录下一些再说~

1、前后文章调用代码

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

2、随机颜色标签云

<?php $this->widget('Widget_Metas_Tag_Cloud', 'ignoreZeroCount=1&limit=30')->to($tags); ?>
<ul class="tags-list">
<?php while($tags->next()): ?>
    <li><a style="color: rgb(<?php echo(rand(0, 255)); ?>, <?php echo(rand(0,255)); ?>, <?php echo(rand(0, 255)); ?>)" href="<?php $tags->permalink(); ?>" title='<?php $tags->name(); ?>'><?php $tags->name(); ?></a></li>
<?php endwhile; ?>
</ul>

3、归档页面模板

<?php
/**
 * 归档页面模板
 *
 * @package custom
 */; ?>

<?php $this->need('header.php'); ?>

    <div class="col-mb-12 col-8" id="main" role="main">
        <h3 class="archive-title">日志归档</h3>
<?php $this->widget('Widget_Contents_Post_Recent', 'pageSize=10000')->to($archives);   
    $year=0; $mon=0; $i=0; $j=0;   
    $output = '<div id="archives">';   
    while($archives->next()):   
        $year_tmp = date('Y',$archives->created);   
        $mon_tmp = date('m',$archives->created);   
        $y=$year; $m=$mon;   
        if ($mon != $mon_tmp && $mon > 0) $output .= '</ul></li>';   
        if ($year != $year_tmp && $year > 0) $output .= '</ul>';   
        if ($year != $year_tmp) {   
            $year = $year_tmp;   
            $output .= '<h3 class="al_year">'. $year .' 年</h3><ul class="al_mon_list">'; //输出年份   
        }   
        if ($mon != $mon_tmp) {   
            $mon = $mon_tmp;   
            $output .= '<li><span class="al_mon">'. $mon .' 月</span><ul class="al_post_list">'; //输出月份   
        }   
        $output .= '<li>'.date('d日: ',$archives->created).'<a href="'.$archives->permalink .'">'. $archives->title .'</a> <em>('. $archives->commentsNum.')</em></li>'; //输出文章日期和标题   
    endwhile;   
    $output .= '</ul></li></ul></div>';   
    echo $output;   
?> 
    </div><!-- end #main -->

    <?php $this->need('sidebar.php'); ?>
    <?php $this->need('footer.php'); ?>

4、段落首行缩进两字符
编辑Style.css文件,增加如下代码:

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

添加新评论

暂无评论

  1. 你是用什么工具排版?

  2. 来撸撸~~

  3. 高中就有如此技术,情不能堪!

  4. 不从

返回顶部