当前位置:网站首页>php 18 首页的文章列表功能实现
php 18 首页的文章列表功能实现
2022-06-13 04:20:00 【qq_42307546】
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>
边栏推荐
- Introduction to MCU peripherals: temperature sensor DS18B20
- Redis data persistence
- 十亿数据量 判断元素是否存在
- Notes on uni app
- Advanced Mathematics (Seventh Edition) Tongji University exercises 1-3 personal solutions
- Redis persistence mode AOF and RDB
- JS common array methods
- ET框架-22 创建ServerInfo实体及事件
- Single chip microcomputer: basic concepts of a/d and d/a
- 出现Could not find com.scwang.smart:refresh-layout-kernel:2.0.3.Required by: project :app 无法加载第三方包情况
猜你喜欢
Alipay native components (hotel time selection)
Knife4j aggregation 2.0.9 supports automatic refresh of routing documents
120. triangle minimum path sum - Dynamic Planning
Reread the classic: end to end object detection with transformers
【LeetCode】860. Change with lemonade (2 brushes for wrong questions)
Understand the pseudo static configuration to solve the 404 problem of refreshing the page of the deployment project
Real time requirements for 5g China Unicom repeater network management protocol
Introduction and use of ES6
Interpretation of usb-if bc1.2 charging protocol
dumi 搭建文档型博客
随机推荐
1-72 convert string to decimal integer
Uni app dynamic add style dynamic bind background image invalid
电磁兼容常用名词术语
[notes] summarize common horizontal and vertical centering methods
Redis data persistence
Ego planner code analysis ----cmakelists Txt and package xml
Applet version update
基于DE2-115平台的VGA显示
[zeloengine] localization process /imgui Chinese culture
10 minutes to thoroughly understand how to configure sub domain names to deploy multiple projects
SCM: introduction to Modbus communication protocol
VGA display based on de2-115 platform
建模杂谈系列143 数据处理、分析与决策系统开发的梳理
Modeling discussion series 143 data processing, analysis and decision system development
El expression
knife4j aggregation 2.0.9支持路由文档自动刷新
解答私信@田田WX //2022-6-12 C语言 51单片机LED模拟交通灯
Single chip microcomputer: main index of a/d (analog-to-digital conversion)
Advanced Mathematics (Seventh Edition) Tongji University exercises 1-2 personal solutions
高等数学(第七版)同济大学 习题1-2 个人解答