/
index.php
133 lines (132 loc) · 5.06 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<?php
/**
* 一款简洁的TYPECHO主题
*
* @package CREAMy
* @author Jayden
* @version 1.0.7
* @link https://iobiji.com
*/
if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<?php
$this->need('header.php');
$hiddens = '';
$hidden = '';
$prev = $this->_currentPage - 1;
$next = $this->_currentPage + 1;
if ($this->_currentPage == 0 || $this->_currentPage == 1) {
$hidden = 'hidden';
$cpage = 1;
} else {
$cpage = $this->_currentPage;
}
if ($this->_currentPage == ceil($this->getTotal() / $this->parameter->pageSize)) {
$hiddens = 'hidden';
} elseif (ceil($this->getTotal() / $this->parameter->pageSize) == 1) {
$hiddens = 'hidden';
$hidden = 'hidden';
}
?>
<section class="site-hero responsive-title-img"
style="background-image: url('<?php if (null != $this->getDescription() && !$this->is('index')) {
echo $this->getDescription();
} else {
Utils::getBackground();
} ?>');">
<div class="container">
<div class="hero-content">
<h1
class="site-name"><?php if ($this->is('category')): ?><?php $this->category('', false); ?><? else: ?><?php $this->options->title(); ?><?php endif ?></h1>
<h2
class="site-description"><?php if ($this->is('category')): ?>A collection of <?php echo Utils::getCnums($this->category) ?> 篇文章 <? else: ?><?php if (!null == $this->options->Subtitle) {
echo $this->options->Subtitle;
} ?><?php endif ?></h2>
</div>
</div>
</section>
<main class="site-main container">
<div class="inner row">
<div class="site-post-list">
<div id="blockGroup" class="post-list">
<?php while ($this->next()): ?>
<?php if ($this->sequence % 2 == 0): ?>
<article class="post-card align-left">
<?php else: ?>
<article class="post-card align-right">
<?php endif ?>
<a href="<?php $this->permalink() ?>" class="post-card-image-link">
<?php if (Utils::isEnabled('enableLazyload', 'JConfig')): ?>
<div class="post-card-image lazyload" data-src="<?php
if ($this->fields->thumbnail) {
echo $this->fields->thumbnail;
} else {
echo Utils::getThumbnail();
}
?>" style="background-image: url(<?php echo Utils::getThumbnail(); ?>)"></div>
<?php else: ?>
<div class="post-card-image" style="background-image: url(<?php
if ($this->fields->thumbnail) {
echo $this->fields->thumbnail;
} else {
echo Utils::getThumbnail();
}
?>)"></div>
<?php endif ?>
</a>
<div class="post-card-content">
<header>
<ul class="post-tags">
<li class="post-tag"><?php $this->category('/'); ?></li>
</ul>
<h3 class="post-card-title"><a href="<?php $this->permalink() ?>"><?php $this->title() ?></a></h3>
</header>
<section class="post-card-excerpt">
<p>
<?php
if ($this->fields->previewContent)
$this->fields->previewContent();
else
$this->excerpt(55, '...');
?>
</p>
</section>
<footer class="post-meta">
<ul class="author-list">
<li class="author-list-item">
<a href="<?php $this->author->permalink(); ?>" class="static-avatar">
<?php echo $this->author->gravatar(320, 'G', NULL, 'author-profile-image') ?>
<span class="author-profile-name"><?php $this->author(); ?></span>
</a>
</li>
</ul>
</footer>
</div>
</article>
<?php endwhile; ?>
</div>
</div>
<div class="site-pagination">
<nav aria-label="文章分页">
<ul class="pagination">
<li class="page-item" <?php echo $hidden ?>>
<a class="page-link" href="/index.php/page/<?php echo $prev ?>" aria-label="上一页">
<span aria-hidden="true">
<i class="fas fa-angle-left"></i>
</span>
</a>
</li>
<li class="page-item"><a class="page-link">第<?= $cpage ?>
页,共<?php echo ceil($this->getTotal() / $this->parameter->pageSize); ?>页</a></li>
<li class="page-item" <?php echo $hiddens ?>>
<a class="page-link" href="/index.php/page/<?php echo $next ?>" aria-label="下一页">
<span aria-hidden="true">
<i class="fas fa-angle-right"></i>
</span>
</a>
</li>
</ul>
</nav>
</div>
</div>
</main>
<?php $this->need('footer.php'); ?>