博主用过的typecho主题不多,见识也有限,在个人用过的主题里功能最全的那必须是joe主题。joe主题不光是有一个很漂亮的前台展现,对主题的后台也进行了美化,以下代码摘录自joe主题的functions.php
文件。
function themeConfig($form)
{
$_db = Typecho_Db::get();
$_prefix = $_db->getPrefix();
try {
if (!array_key_exists('views', $_db->fetchRow($_db->select()->from('table.contents')->page(1, 1)))) {
$_db->query('ALTER TABLE `' . $_prefix . 'contents` ADD `views` INT DEFAULT 0;');
}
if (!array_key_exists('agree', $_db->fetchRow($_db->select()->from('table.contents')->page(1, 1)))) {
$_db->query('ALTER TABLE `' . $_prefix . 'contents` ADD `agree` INT DEFAULT 0;');
}
} catch (Exception $e) {
}
?>
<link rel="stylesheet" href="<?php _getAssets('assets/typecho/config/css/joe.config.min.css') ?>">
<script src="<?php _getAssets('assets/typecho/config/js/joe.config.min.js') ?>"></script>
<div class="joe_config">
<div>
<div class="joe_config__aside">
<div class="logo">Joe <?php echo _getVersion() ?></div>
<ul class="tabs">
<li class="item" data-current="joe_notice">最新公告</li>
<li class="item" data-current="joe_global">全局设置</li>
<li class="item" data-current="joe_image">图片设置</li>
<li class="item" data-current="joe_post">文章设置</li>
<li class="item" data-current="joe_aside">侧栏设置</li>
<li class="item" data-current="joe_index">首页设置</li>
<li class="item" data-current="joe_other">其他设置</li>
</ul>
<?php require_once('core/backup.php'); ?>
</div>
</div>
<div class="joe_config__notice">请求数据中...</div>
<?php
...
可以看到,在?>...<?php
之间,插入了css文件,js文件,以及一个自定义的列表。如果需要对我们自己的后台进行美化,也可以模仿joe主题的这种方式。typecho的很多主题都开放了源码,比如joe主题就可以直接在github上下载到,类似的还有lpisme主题,Facile主题等等。