index.php
<?php
include_once 'init.php';
$page=isset($_GET['page'])? $_GET['page']:1;
$subPages=8;
include_once "common/Page.class.php";
$result = $conn->query('select * from config');
while($row = $result->fetch_assoc()){
$web[$row['name']]=$row['value'];
}
?>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title><?php echo $web['website_title']; ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="<?php echo $web['website_desc'];?>" />
<meta name="keywords" content="<?php echo $web['website_keywords'];?>" />
<meta name="author" content="moonsec" />
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="css/materialdesignicons.min.css" />
<link rel="stylesheet" type="text/css" href="css/style.min.css" />
</head>
<body>
<header class="lyear-header text-center" style="background-image:url(images/left-bg.jpg);">
<div class="lyear-header-container">
<div class="lyear-mask"></div>
<h1 class="lyear-blogger pt-lg-4 mb-0"><a href="index.php"><?php echo $web['website_title']; ?></a></h1>
<nav class="navbar navbar-expand-lg">
<a class="navbar-toggler" data-toggle="collapse" data-target="#navigation" aria-controls="navigation" aria-expanded="false" aria-label="Toggle navigation">
<div class="lyear-hamburger">
<div class="hamburger-inner"></div>
</div>
</a>
<div id="navigation" class="collapse navbar-collapse flex-column">
<div class="profile-section pt-3 pt-lg-0">
<img class="profile-image mb-3 rounded-circle mx-auto" src="images/img.png" width="200" height="200" alt="笔下光年" >
<div class="lyear-sentence mb-3">必须记住我们学习的时间是有限的。时间有限,不只由于人生短促,更由于人事纷繁。我们就应力求把我们所有的时间用去做最有益的事情。</div>
<hr>
</div>
<ul class="navbar-nav flex-column text-center">
<li class="nav-item active">
<a class="nav-link" href="index.php">首页</a>
</li>
<?php
$result=$conn->query('select * from cate ');
while($row=$result->fetch_assoc()){
?>
<li class="nav-item">
<a class="nav-link" href="post.php?id=<?php echo $row['id'];?>"><?php echo $row['class_name'];?></a>
</li>
<?php
}
?>
<li class="nav-item">
<a class="nav-link" href="about.html">关于我</a>
</li>
</ul>
<div class="my-2 my-md-3">
<form class="lyear-search-form form-inline justify-content-center pt-3">
<input type="email" id="semail" name="semail1" class="form-control mr-md-1" placeholder="搜索关键词" />
</form>
</div>
</div>
</nav>
</div>
</header>
<div class="lyear-wrapper">
<section class="mt-5 pb-5">
<div class="container">
<div class="row">
<!-- 文章列表 -->
<div class="col-xl-8">
<?php
$result = $conn->query("select a.id,a.title,a.n,a.author,a.c_time,b.class_name,a.content,a.keyword from article as a,cate as b where a.catid = b.id order by a.id");
while($row=$result->fetch_assoc()){
?>
<article class="lyear-arc">
<div class="arc-header">
<h2 class="arc-title"><a href="post.html"><?php echo $row['title'];?></a></h2>
<ul class="arc-meta">
<li><i class="mdi mdi-calendar"></i> <?php echo date("Y-m-d H:i:s",$row['c_time']);?></li>
<li><i class="mdi mdi-tag-text-outline"></i> <a href="#"><?php echo $row['keywords'];?></a> <a href="#"><?php echo $row['class_name'];?></a></li>
</ul>
</div>
<div class="arc-synopsis">
<p><?php echo $row['content'];?></p>
</div>
<?php }?>
</article>
<!-- 分页 -->
<div class="row">
<?php
$result1=$conn->query("select * from article as a,cate as b where a.catid = b.id order by a.id desc ");
$result_count1=$result1->num_rows;
$p = new Page($result_count1,4,$page,$subPages);
echo $p->showPages(1);
?>
</div>
<!-- 分页 end -->
</div>
<!-- 内容 end -->
<!-- 侧边栏 -->
<div class="col-xl-4">
<div class="lyear-sidebar">
<!-- 热门文章 -->
<aside class="widget widget-hot-posts">
<div class="widget-title">热门文章</div>
<ul>
<li>
<a href="#">三星将为 Galaxy Fold 用户提供 149 美元更换屏幕服务</a> <span>2019-09-25 10:05</span>
</li>
<li>
<a href="#">专家:10年后6G将问世 数据传输速率有望比5G快100倍</a> <span>2019-09-25 08:06</span>
</li>
<li>
<a href="#">苹果正式发布 iPadOS 13.1 系统,加入多项强大新功能</a> <span>2019-09-25 09:35</span>
</li>
</ul>
</aside>
<!-- 归档 -->
<aside class="widget">
<div class="widget-title">归档</div>
<ul>
<li><a href="#">2019 三月</a> (40)</li>
<li><a href="#">2019 四月</a> (08)</li>
<li><a href="#">2019 五月</a> (11)</li>
<li><a href="#">2019 六月</a> (21)</li>
</ul>
</aside>
<!-- 标签 -->
<aside class="widget widget-tag-cloud">
<div class="widget-title">标签</div>
<div class="tag-cloud">
<a href="#" class="badge badge-light">php</a>
<a href="#" class="badge badge-primary">苹果</a>
<a href="#" class="badge badge-danger">比特币</a>
<a href="#" class="badge badge-light">linux</a>
<a href="#" class="badge badge-light">前端</a>
<a href="#" class="badge badge-light">vue</a>
</div>
</aside>
</div>
</div>
<!-- 侧边栏 end -->
</div>
</div>
<!-- end container -->
</section>
</div>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.nicescroll.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/main.min.js"></script>
</body>
</html>