-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathsidebar.php
51 lines (51 loc) · 3.53 KB
/
sidebar.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
<aside class="site-aside">
<div class="aside-wrapper">
<a href="<?php $this->options->siteUrl(); ?>" class="aside-brand d-none d-xl-flex" rel="home">
<img src="<?php empty($this->options->biglogo) ? $this->options->themeUrl('/assets/image/head.png') : $this->options->biglogo(); ?>" class="logo nc-no-lazy" alt="<?php $this->options->title(); ?>">
<img src="<?php empty($this->options->smalllogo) ? $this->options->themeUrl('/assets/image/favicon.ico') : $this->options->smalllogo(); ?>" class="logo-sm nc-no-lazy" alt="<?php $this->options->title(); ?>">
</a>
<div class="aside-scroll scrollable hover">
<ul class="aside-menu">
<?php global $category;
$db = Typecho_Db::get();
$parent = $db->fetchAll($db->select('mid,name,slug')->from('table.metas')
->where('type = ? AND parent = ?', 'category', '0')
->order('order', Typecho_Db::SORT_ASC));
foreach ($parent as $item) :
$children = $db->fetchAll($db->select('mid,name,slug')->from('table.metas')
->where('type = ? AND parent = ? AND count > 0', 'category', $item['mid'])
->order('order', Typecho_Db::SORT_ASC));
if (empty($children)) :
$category[] = $item; ?>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<?php $onclick = $this->is('index') ? "document.getElementById('" . $item['slug'] . "').scrollIntoView({behavior: 'smooth', block: 'center'})" : "window.location.href = '/'"; ?>
<a onclick="<?php echo $onclick; ?>" aria-current="page">
<span class="menu-icon"><i class="fas fa-<?php echo $item['slug']; ?> fa-sm"></i></span>
<span class="menu-text"><?php echo $item['name'] ?></span>
</a>
</li>
<?php else : ?>
<li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children">
<a>
<span class="menu-icon"><i class="fas fa-<?php echo $item['slug']; ?> fa-sm"></i></span>
<span class="menu-text"><?php echo $item['name'] ?></span>
<span class="menu-sign fas fa-arrow-right fa-sm"></span>
</a>
<ul class="sub-menu" role="menu">
<?php foreach ($children as $child) :
$category[] = $child; ?>
<li class="menu-item menu-item-type-taxonomy menu-item-object-category">
<?php $onclick = $this->is('index') ? "document.getElementById('" . $child['slug'] . "').scrollIntoView({behavior: 'smooth', block: 'center'})" : "window.location.href = '/'"; ?>
<a onclick="<?php echo $onclick; ?>" aria-current="page">
<span class="menu-text"><?php echo $child['name'] ?></span>
</a>
</li>
<?php endforeach; ?>
</ul>
</li>
<?php endif;
endforeach; ?>
</ul>
</div>
</div>
</aside>