Skip to content

Commit 46f984a

Browse files
authored
第一次提交
0 parents  commit 46f984a

File tree

11 files changed

+503
-0
lines changed

11 files changed

+503
-0
lines changed

404.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
if (!defined('__TYPECHO_ROOT_DIR__')) {
3+
error_log('__TYPECHO_ROOT_DIR__ is not defined.');
4+
exit();
5+
}
6+
7+
if (!function_exists('_e')) {
8+
function _e($text)
9+
{
10+
return $text;
11+
}
12+
}
13+
14+
$this->need('header.php');
15+
?>
16+
<main>
17+
<h1> 404 - <?php _e('页面没找到'); ?></h1>
18+
<h3> <?php _e('你想查看的页面已被转移或删除了, 要不要搜索看看: '); ?></h3>
19+
</main>
20+
<?php $this->need('footer.php');
21+
?>

README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# typecho-theme-final
2+
3+
```
4+
/**
5+
* 你的最后一个主题。接下来请专心写作吧。
6+
* Your final theme. Please focus on writing next.
7+
*
8+
* @package final
9+
* @author HoytZhang
10+
* @version 1.0
11+
* @link https://github.com/hoytzhang/
12+
*/
13+
```
14+
15+
![screenshot](./screenshot.png)
16+
17+
如果你想添加导航,下面是代码(样式文件已经包含在style.css中):
18+
19+
```
20+
<nav>
21+
<p>
22+
<a<?php if ($this->is('index')): ?> <?php endif; ?>
23+
href="<?php $this->options->siteUrl(); ?>"><?php _e('首页'); ?></a>
24+
<?php \Widget\Contents\Page\Rows::alloc()->to($pages); ?>
25+
<?php while ($pages->next()): ?>
26+
<a<?php if ($this->is('page', $pages->slug)): ?> <?php endif; ?>
27+
href="<?php $pages->permalink(); ?>"
28+
title="<?php $pages->title(); ?>"><?php $pages->title(); ?></a>
29+
<?php endwhile; ?>
30+
</p>
31+
</nav>
32+
```
33+
34+
```
35+
36+
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
37+
Version 2, December 2004
38+
39+
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
40+
41+
Everyone is permitted to copy and distribute verbatim or modified
42+
copies of this license document, and changing it is allowed as long
43+
as the name is changed.
44+
45+
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
46+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
47+
48+
0. You just DO WHAT THE FUCK YOU WANT TO.
49+
50+
```

archive.php

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
2+
<?php $this->need('header.php'); ?>
3+
<main>
4+
<h3 style="margin-bottom:0"><?php $this->archiveTitle([
5+
'category' => _t('分类 %s 下的文章'),
6+
'search' => _t('包含关键字 %s 的文章'),
7+
'tag' => _t('标签 %s 下的文章'),
8+
'author' => _t('%s 发布的文章')
9+
], '', ''); ?></h3>
10+
<ul class="blog-posts">
11+
<?php if ($this->have()): ?>
12+
<?php while ($this->next()): ?>
13+
<li>
14+
<span>
15+
<i>
16+
<time datetime="<?php $this->date('c'); ?>">
17+
<?php $this->date(); ?>
18+
</time>
19+
</i>
20+
</span>
21+
<a href="<?php $this->permalink() ?>"><?php $this->title() ?></a>
22+
</li>
23+
<?php endwhile; ?>
24+
<?php else: ?>
25+
<article class="post">
26+
<h2 class="post-title"><?php _e('没有找到内容'); ?></h2>
27+
</article>
28+
<?php endif; ?>
29+
</ul>
30+
31+
<?php if ( $this->is('archive') || $this->is('index') ) { ?>
32+
<div class="post-pagination">
33+
<?php $this->pageNav('&nbsp;←&nbsp;', '&nbsp;→&nbsp;', '5', ''); ?>
34+
</div>
35+
<?php }; ?>
36+
<?php else : ?><article><em>空空如也 ...</em></article><?php endif; ?>
37+
38+
39+
</main>
40+
<?php $this->need('footer.php'); ?>

footer.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
2+
3+
<footer style="margin:50px 0px">
4+
5+
<span id="footer-directive">
6+
7+
<?php $this->options->addfoot() ?>
8+
9+
</span>
10+
11+
<span>
12+
13+
&copy; 2024 <a href="<?php $this->options->siteUrl(); ?>"><?php $this->options->title(); ?></a>
14+
15+
</span>
16+
17+
</footer>
18+
19+
</body>
20+
21+
</html>

functions.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
3+
4+
function themeConfig($form)
5+
{
6+
$logoUrl = new \Typecho\Widget\Helper\Form\Element\Text(
7+
'logoUrl',
8+
null,
9+
'default-logo.png',
10+
_t('站点 LOGO 地址'),
11+
_t('在这里填入一个图片 URL 地址')
12+
);
13+
$form->addInput($logoUrl);
14+
15+
$addfoot = new \Typecho\Widget\Helper\Form\Element\Textarea(
16+
'addfoot',
17+
null,
18+
null,
19+
_t('页脚代码,可填写备案,统计等信息'),
20+
_t('支持HTML')
21+
);
22+
$form->addInput($addfoot);
23+
24+
}

header.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
2+
<!DOCTYPE html>
3+
<html lang="zh">
4+
<head>
5+
<meta charset="<?php $this->options->charset(); ?>">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5">
7+
<title><?php $this->archiveTitle([
8+
'category' => _t('分类 %s 下的文章'),
9+
'search' => _t('包含关键字 %s 的文章'),
10+
'tag' => _t('标签 %s 下的文章'),
11+
'author' => _t('%s 发布的文章')
12+
], '', ' - '); ?><?php $this->options->title(); ?></title>
13+
<link rel="canonical" href="<?php $this->options->siteUrl(); ?>">
14+
<meta name="title" content="<?php $this->options->title(); ?>">
15+
<meta name="description" content="<?php $this->options->description() ?: _e('默认描述内容'); ?>">
16+
<link rel="alternate" type="application/atom+xml" href="<?php $this->options->siteUrl(); ?>feed/">
17+
<link rel="shortcut icon" type="image/svg+xml" href="<?php $this->options->logoUrl() ?>">
18+
<link rel="stylesheet" href="<?php $this->options->themeUrl('style.css'); ?>">
19+
20+
<?php if (method_exists($this, 'header')): ?>
21+
<?php $this->header(); ?>
22+
<?php endif; ?>
23+
</head>
24+
<body class="home">
25+
<header>
26+
27+
</header>

index.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
/**
3+
* 你的最后一个主题。接下来请专心写作吧。
4+
* Your final theme. Please focus on writing next.
5+
*
6+
* @package final
7+
* @author HoytZhang
8+
* @version 1.0
9+
* @link https://banzhuanriji.com
10+
*/
11+
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
12+
$this->need('header.php');
13+
?>
14+
<a class="title" href="/">
15+
<h1><?php $this->options->title(); ?></h1>
16+
</a>
17+
<main>
18+
19+
<?php if ($this->have()): ?>
20+
<?php while ($this->next()): ?>
21+
<div class="post-item">
22+
<a href="<?php $this->permalink() ?>"><?php $this->title() ?></a><time datetime="<?php $this->date('c'); ?>" itemprop="datePublished"><?php $this->date(); ?></time>
23+
</div>
24+
<?php endwhile; ?>
25+
26+
<?php if ( $this->is('archive') || $this->is('index') ) { ?>
27+
<div class="post-pagination">
28+
<?php $this->pageNav('&nbsp;←&nbsp;', '&nbsp;→&nbsp;', '5', ''); ?>
29+
</div>
30+
<?php }; ?>
31+
<?php else : ?><article><em>空空如也 ...</em></article><?php endif; ?>
32+
33+
</main>
34+
<?php $this->need('footer.php'); ?>

page.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
2+
<?php $this->need('header.php'); ?>
3+
<main>
4+
<h1><?php $this->title(); ?></h1>
5+
<p>
6+
<i>
7+
<time datetime="<?php $this->date('c'); ?>">
8+
<?php $this->date('Y-m-d H:i'); ?>
9+
</time>
10+
</i>
11+
</p>
12+
<?php if ($this->content): ?>
13+
<?php $this->content(); ?>
14+
<?php else: ?>
15+
<p>此页面内容尚未发布。</p>
16+
<?php endif; ?>
17+
</main>
18+
<?php $this->need('footer.php'); ?>

post.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
2+
<?php $this->need('header.php'); ?>
3+
<main>
4+
<h1><a href="<?php $this->options->siteUrl(); ?>"><?php $this->title(); ?></a></h1>
5+
<p>
6+
<i>
7+
<time datetime="<?php $this->date('c'); ?>">
8+
<?php $this->date('Y-m-d H:i'); ?>
9+
</time>
10+
·
11+
</i>
12+
<?php $this->category(' · '); ?>
13+
</p>
14+
<?php if ($this->content): ?>
15+
<?php $this->content(); ?>
16+
<?php else: ?>
17+
<p>此文章内容尚未发布。</p>
18+
<?php endif; ?>
19+
<p class="tags">
20+
<?php $this->tags(' · ', true, ' '); ?>
21+
</p>
22+
</main>
23+
<?php $this->need('footer.php'); ?>

screenshot.png

687 Bytes
Loading

0 commit comments

Comments
 (0)