博客列表 >12月9日大作业--php培训九期线上班

12月9日大作业--php培训九期线上班

取个名字真难
取个名字真难原创
2019年12月16日 13:58:04709浏览

connect数据库链接

  1. <?php
  2. /** 变量配置 **/
  3. define('DB_NAME', 'dedecmsv57');
  4. define('DB_USER', 'root');
  5. define('DB_PASSWORD', '123456');
  6. define('DB_HOST', 'localhost');
  7. //创建链接数据库的类和数据库操作
  8. class Sql_db
  9. {
  10. public $pdo;
  11. // 链接数据库
  12. public function conect($host,$dbname,$user,$pass)
  13. {
  14. $dsn = "mysql:host=$host; dbname=$dbname;";
  15. try{
  16. $pdo=new PDO($dsn,$user,$pass);
  17. }catch (PDOException $e){
  18. die('数据库错误:'.$e->getMessage());
  19. }
  20. return $pdo;
  21. }
  22. }

head头部及首页的php代码

  1. <?php
  2. // 连接数据库:$pdo
  3. include 'connect.php';
  4. //创建一个Sql_db的子类
  5. class select extends Sql_db{
  6. public $pdo;
  7. public function __construct()
  8. {
  9. // 调用父类方法链接数据库
  10. $this->pdo= parent::conect(DB_HOST,DB_NAME,DB_USER,DB_PASSWORD);
  11. }
  12. // 查询栏目信息和链接
  13. public function selHead(){
  14. $sql = 'select * from `coumn` ';
  15. $stmt = $this->pdo->prepare($sql);
  16. $stmt->execute();
  17. $cates = $stmt->fetchAll(PDO::FETCH_ASSOC);
  18. foreach ($cates as $cate){
  19. echo ' <li><a href="'. $cate['url'].'.php'.'?id='.$cate['id'].'">'.$cate['cname'].'</a></li>';
  20. }
  21. }
  22. // 首页换灯图片
  23. public function selPic(){
  24. $sql = 'select `titlename`,`imageurl` from `images` ';
  25. $stmt = $this->pdo->prepare($sql);
  26. $stmt->execute();
  27. $cates = $stmt->fetchAll(PDO::FETCH_ASSOC);
  28. // 图片路径
  29. $imgpath='static/images/';
  30. foreach ($cates as $cate){
  31. if ($cate['imageurl']===$cate['titlename'])
  32. {
  33. echo '<div><img src= '.$imgpath.$cate['titlename'].'></div>';
  34. }
  35. }
  36. }
  37. // 查询首页h3红色标题图片
  38. public function selTitle(){
  39. $sql = 'select `*` from `article` limit 1 ';
  40. $stmt = $this->pdo->prepare($sql);
  41. $stmt->execute();
  42. $article = $stmt->fetchAll(PDO::FETCH_ASSOC);
  43. foreach ($article as $art)
  44. {
  45. echo '<h3><a href="article.php?id='.$art['id'].'" >'.$art['title'].'</a></h3>';
  46. }
  47. }
  48. //首页新闻资讯
  49. public function selNew($a){
  50. // 变量$limit控制显示的条数
  51. $limit='limit '.$a;
  52. $sql = 'select `*` from `article` '. $limit;
  53. $stmt = $this->pdo->prepare($sql);
  54. $stmt->execute();
  55. $article = $stmt->fetchAll(PDO::FETCH_ASSOC);
  56. foreach ($article as $art)
  57. {
  58. echo '<li>
  59. <span>[新闻]</span>
  60. <a href="article.php?id='.$art['id'].'" >'.$art['title'].'</a>
  61. </li>';
  62. }
  63. }
  64. //首页新闻频道图片
  65. public function selImage($a){
  66. // 变量$limit控制显示的行数
  67. $limit='limit '.$a;
  68. // 图片路径
  69. $imgPath='static/images/';
  70. $sql = 'select `*` from `article` '.$limit;
  71. $stmt = $this->pdo->prepare($sql);
  72. $stmt->execute();
  73. $article = $stmt->fetchAll(PDO::FETCH_ASSOC);
  74. foreach ($article as $art)
  75. {
  76. echo '<dd class="phpcn-col-md6">
  77. <a href="article.php?id='.$art['id'].'" ><img src='.$imgPath.$art['img'].'>
  78. <span>'.$art['title'].'</span>
  79. </a>
  80. </dd>';
  81. }
  82. }
  83. //首页图片频道图片
  84. public function imageChan($a,$b){
  85. if ($b==0){
  86. $limit='limit '.$a;
  87. }else{
  88. $limit='limit '.$a.','.$b;
  89. }
  90. // 图片频道图片路径
  91. $imgpath='static/images/shop/';
  92. $sql = 'select `*` from `images`'.$limit ;
  93. $stmt = $this->pdo->prepare($sql);
  94. $stmt->execute();
  95. $pic = $stmt->fetchAll(PDO::FETCH_ASSOC);
  96. foreach ($pic as $p)
  97. {
  98. echo '<li class="phpcn-col-md6">
  99. <a href="images-content.php?id='.$p['id'].'"><img src='.$imgpath.$p['imageurl'].'>
  100. <span>'.$p['titlename'].'</span>
  101. </a>
  102. </dd></li>';
  103. }
  104. }
  105. // 首页商品
  106. public function selShop(){
  107. $sql = 'select `*` from `shop` ';
  108. $stmt = $this->pdo->prepare($sql);
  109. $stmt->execute();
  110. $pic = $stmt->fetchAll(PDO::FETCH_ASSOC);
  111. foreach ($pic as $p)
  112. {
  113. echo '<dd class="phpcn-col-md3">
  114. <a href="shop-content.php?id='.$p['id'].'"><img src="static/images/shop/'.$p['img'].'"></a>
  115. <a href="shop-content.php?id='.$p['id'].'">'.$p['title'].'<a href="" class="phpcn-mt-10">
  116. <span class="price">'.$p['price'].'</span>
  117. <span class="tags">美女</span></a></dd>';
  118. }
  119. }
  120. //**************************************************************************************
  121. //列表页面
  122. public function listSel($a=10){
  123. // 变量$limit控制显示的行数默认10行
  124. $limit='limit '.$a;
  125. $sql = 'select `*` from `article` '. $limit;
  126. $stmt = $this->pdo->prepare($sql);
  127. $stmt->execute();
  128. $article = $stmt->fetchAll(PDO::FETCH_ASSOC);
  129. foreach ($article as $cate)
  130. {
  131. echo ' <div class="phpcn-clear phpcn-mt-30">
  132. <div class="phpcn-col-md4"><img src="static/images/'. $cate['img']. '"> </div>
  133. <div class="phpcn-col-md8">
  134. <h2><a href="article.php?id='.$cate['id'].'">'.$cate['title'].'</a></h2>
  135. <div class="info phpcn-mt-10">'.$cate['title'].'
  136. </div>
  137. <div>
  138. <a href="article.php?id='.$cate['id'].'">区块链头条 '.$cate['times'].'</a>
  139. <span>
  140. <i class="phpcn-icon phpcn-icon-icon_yulan phpcn-r phpcn-mr-20">'.$cate['click'].'</i>
  141. </span>
  142. </div>
  143. </div>
  144. </div>' ;
  145. }
  146. }
  147. //列表页推荐阅读
  148. public function reading ($limit){
  149. $limit='limit'.$limit;
  150. $sql = 'select `*` from `article` '. $limit;
  151. $stmt = $this->pdo->prepare($sql);
  152. $stmt->execute();
  153. $article = $stmt->fetchAll(PDO::FETCH_ASSOC);
  154. foreach ($article as $cate) {
  155. echo '<li class="phpcn-col-md3">
  156. <div>
  157. <a href="article.php?id='.$cate['id'].'"> <img src="static/images/'.$cate['img'].'"> </a>
  158. <a href="article.php?id='.$cate['id'].'">'.$cate['title'].'</a>
  159. </div>
  160. </li>';
  161. }
  162. }
  163. //网页评论
  164. public function comments($limit){
  165. $limit='limit '.$limit;
  166. $sql = 'select `*` from `article` '. $limit;
  167. $stmt = $this->pdo->prepare($sql);
  168. $stmt->execute();
  169. $article = $stmt->fetchAll(PDO::FETCH_ASSOC);
  170. $i=1;
  171. foreach ($article as $cate) {
  172. echo '<li>
  173. <span class="hot">'.$i++.'</span>
  174. <a href="article.php?id='.$cate['id'].'">'.$cate['title'].'</a>
  175. </li>';
  176. }
  177. }
  178. }
  179. //实例化查询对象
  180. $selHead=new select();
  181. ?>
  182. <!DOCTYPE html>
  183. <html lang="en">
  184. <head>
  185. <meta charset="UTF-8">
  186. <link rel="stylesheet" href="static/css/style.css?ddd" media="all">
  187. <link rel="stylesheet" href="static/css/home.css?ddd" media="all">
  188. <script src="static/js/jquery3.4.1.js"></script>
  189. <title>php中文网后台</title>
  190. </head>
  191. <body>
  192. <div class="home-top phpcn-clear">
  193. <ul class='phpcn-col-md10'>
  194. <li ><a href="index.php">首页</a></li>
  195. <?php $selHead->selHead(); ?>
  196. </ul>
  197. <dl class='phpcn-col-md2'>
  198. <dd>
  199. <a href="">免费注册</a>
  200. </dd>
  201. <dd>
  202. <a href=""><i class="phpcn-icon phpcn-icon-huiyuan2"></i>登陆</a>
  203. </dd>
  204. </dl>
  205. </div>

index首页

  1. <?php
  2. include __DIR__ . "/head.php";
  3. ?>
  4. <!DOCTYPE html>
  5. <!--头部结束--->
  6. <!--LOGO与搜索--->
  7. <div class="phpcn-main phpcn-mt-60">
  8. <div class="logo-top phpcn-clear">
  9. <div class="phpcn-col-md4">
  10. <a href="">
  11. <img src="static/images/logo.png">
  12. </a>
  13. </div>
  14. <div class="phpcn-col-md4">
  15. <input type="" name="">
  16. <i class="phpcn-icon phpcn-icon-jinduchaxun"></i>
  17. </div>
  18. <div class="phpcn-col-md4">
  19. <dl class="erwei-code">
  20. <dd>
  21. <a href=""><i class="phpcn-icon phpcn-icon-huiyuan1"></i></a>
  22. </dd>
  23. <dd>
  24. <a href=""><i class="phpcn-icon phpcn-icon-danmu1"></i></a>
  25. </dd>
  26. <dd>
  27. <a href=""><i class="phpcn-icon phpcn-icon-duoxuankuang1"></i></a>
  28. </dd>
  29. <dd>
  30. <a href=""><i class="phpcn-icon phpcn-icon-jishufuwu"></i></a>
  31. </dd>
  32. <dd>
  33. <a href=""><i class="phpcn-icon phpcn-icon-peiwangyindao"></i></a>
  34. </dd>
  35. <dd>
  36. <a href=""><i class="phpcn-icon phpcn-icon-wenjianjia"></i></a>
  37. </dd>
  38. <dd>
  39. <a href=""><i class="phpcn-icon phpcn-icon-huiyuan1"></i></a>
  40. </dd>
  41. </dl>
  42. </div>
  43. </div>
  44. <!--LOGO与搜索结束--->
  45. <!--菜单 开始 --->
  46. <div class="menu phpcn-mt-30 phpcn-clear">
  47. <div >
  48. <dl class="phpcn-col-md3">
  49. <dt>
  50. <i class="phpcn-icon phpcn-icon-gongdan"></i>
  51. <span>资讯看学</span>
  52. </dt>
  53. <dd>
  54. <a href="">器材</a>
  55. <a href="">大师</a>
  56. <a href="">学院</a>
  57. <a href="">影赛</a>
  58. <a href="">器材</a>
  59. <a href="">大师</a>
  60. <a href="">学院</a>
  61. <a href="">影赛</a>
  62. </dd>
  63. </dl>
  64. <dl class="phpcn-col-md2">
  65. <dt>
  66. <i class="phpcn-icon phpcn-icon-renwujincheng"></i>
  67. <span>资讯看学</span>
  68. </dt>
  69. <dd>
  70. <a href="">器材</a>
  71. <a href="">大师</a>
  72. <a href="">学院</a>
  73. <a href="">影赛</a>
  74. </dd>
  75. </dl>
  76. <dl class="phpcn-col-md2">
  77. <dt>
  78. <i class="phpcn-icon phpcn-icon-gongdan"></i>
  79. <span>资讯看学</span>
  80. </dt>
  81. <dd>
  82. <a href="">器材</a>
  83. <a href="">大师</a>
  84. <a href="">学院</a>
  85. <a href="">影赛</a>
  86. </dd>
  87. </dl>
  88. <dl class="phpcn-col-md4">
  89. <dt>
  90. <i class="phpcn-icon phpcn-icon-DOC"></i>
  91. <span>资讯看学</span>
  92. </dt>
  93. <dd>
  94. <a href="">器材</a>
  95. <a href="">大师</a>
  96. <a href="">学院</a>
  97. <a href="">影赛</a>
  98. <a href="">器材</a>
  99. <a href="">大师</a>
  100. <a href="">学院</a>
  101. <a href="">影赛</a>
  102. <a href="">器材</a>
  103. <a href="">大师</a>
  104. <a href="">学院</a>
  105. <a href="">影赛</a>
  106. </dd>
  107. </dl>
  108. </div>
  109. </div>
  110. <!--菜单 结束--->
  111. <!--幻灯片-->
  112. <div class="phpcn-clear banner phpcn-mt-30 ">
  113. <div class="phpcn-col-md9 " >
  114. <div class="pi">
  115. <div class="pike">
  116. <!-- // 换灯图片-->
  117. <?php $selHead->selPic(); ?>
  118. </div>
  119. <div class="pike_prev"></div>
  120. <div class="pike_next"></div>
  121. <div class="pike_spot"></div>
  122. </div>
  123. </div>
  124. <div class="phpcn-col-md3" >
  125. <img class="phpcn-r banner-right" src="static/images/banner-right.jpg">
  126. </div>
  127. </div>
  128. <!--幻灯片结束-->
  129. <!--新聞開始-->
  130. <div class="home-news phpcn-mt-30">
  131. <div class="title phpcn-mb-20">
  132. <a href="" class="tit">新闻资讯</a>
  133. <span class="phpcn-r"><a href="">更多</a></span>
  134. </div>
  135. <div class="phpcn-clear ">
  136. <div class="phpcn-col-md4">
  137. <img src="static/images/news.jpg">
  138. </div>
  139. <div class="phpcn-col-md4">
  140. <!-- 查询首页h3红色标题图片-->
  141. <?php $selHead->selTitle(); ?>
  142. <ul>
  143. <!-- //首页新闻资讯-->
  144. <!-- 显示4行-->
  145. <?php $selHead->selNew(4); ?>
  146. </ul>
  147. </div>
  148. <div class="phpcn-col-md4">
  149. <!-- 查询首页h3红色标题图片-->
  150. <?php $selHead->selTitle(); ?>
  151. <ul>
  152. <!-- //首页新闻资讯-->
  153. <!-- 显示4行-->
  154. <?php $selHead->selNew(4); ?>
  155. </ul>
  156. </div>
  157. </div>
  158. <div class="phpcn-clear phpcn-mt-30">
  159. <div class="phpcn-col-md4">
  160. <dl class="pic">
  161. <!-- //首页新闻频道图片-->
  162. <?php $selHead->selImage(2); ?>
  163. </dl>
  164. </div>
  165. <div class="phpcn-col-md4">
  166. <ul>
  167. <!-- 显示5行-->
  168. <?php $selHead->selNew(5); ?>
  169. </ul>
  170. </div>
  171. <div class="phpcn-col-md4">
  172. <ul>
  173. <!-- 显示5行-->
  174. <?php $selHead->selNew(5); ?>
  175. </ul>
  176. </div>
  177. </div>
  178. </div>
  179. <!--新聞開始結束-->
  180. </div>
  181. <!--LOGO与搜索结束--->
  182. <!--图片开始-->
  183. <div class="phpcn-clear phpcn-mt-30" style='background:#eee;'>
  184. <div class="phpcn-main">
  185. <div class="phpcn-clear home-img">
  186. <div class="title-header phpcn-mb-40 phpcn-mt-20"><span>图片专区</span></div>
  187. <div class=" phpcn-clear phpcn-col-space15">
  188. <div class="phpcn-col-md4">
  189. <div class="bg">
  190. <div class="title "><a href="">美女</a> <span>纵观摄影艺术</span></div>
  191. <ul class="phpcn-clear">
  192. <!-- 根据传递的参数不同调用不同的数据-->
  193. <?php $selHead->imageChan(0,4); ?>
  194. </ul>
  195. </div>
  196. </div>
  197. <div class="phpcn-col-md4">
  198. <div class="bg">
  199. <div class="title "><a href="">美女</a> <span>纵观摄影艺术</span></div>
  200. <ul class="phpcn-clear">
  201. <!-- 根据传递的参数不同调用不同的数据-->
  202. <?php $selHead->imageChan(0,4); ?>
  203. </ul>
  204. </div>
  205. </div>
  206. <div class="phpcn-col-md4">
  207. <div class="bg">
  208. <div class="title "><a href="">美女</a> <span>纵观摄影艺术</span></div>
  209. <ul class="phpcn-clear">
  210. <!--根据传递的参数不同调用不同的数据-->
  211. <?php $selHead->imageChan(0,4); ?>
  212. </ul>
  213. </div>
  214. </div>
  215. </div>
  216. </div>
  217. <!--图片开始结束-->
  218. <!--商城开始-->
  219. <div class="phpcn-clear">
  220. <div class="title-header phpcn-mb-40 phpcn-mt-20"><span>二手交易</span></div>
  221. <div class="home-shop phpcn-clear">
  222. <div class="title "><a href="">抢好货</a> <span>0低价、便捷、安全、快速</span></div>
  223. <div class='head-tags'>
  224. <span>热门分类:</span>
  225. <a href="">美女写真</a>
  226. <a href="">日本美女</a>
  227. <a href="">美国美女</a>
  228. <a href="">国内美女</a>
  229. <a href="">AV美女</a>
  230. </div>
  231. <div class="phpcn-clear">
  232. <div class="phpcn-col-md8">
  233. <dl>
  234. <!-- 商品调用-->
  235. <?php $selHead->selShop(); ?>
  236. </dl>
  237. </div>
  238. <div class="phpcn-col-md4 home-ad">
  239. <ul class="phpcn-clear">
  240. <li class="phpcn-col-md6">
  241. <a href="">
  242. <img src="static/images/ad/1.png">
  243. </a>
  244. </li>
  245. <li class="phpcn-col-md6">
  246. <a href="">
  247. <img src="static/images/ad/2.png">
  248. </a>
  249. </li>
  250. <li class="phpcn-col-md6">
  251. <a href="">
  252. <img src="static/images/ad/3.png">
  253. </a>
  254. </li>
  255. <li class="phpcn-col-md6">
  256. <a href="">
  257. <img src="static/images/ad/4.png">
  258. </a>
  259. </li>
  260. </ul>
  261. <div class="phpcn-mt-10">
  262. <a href="">
  263. <img src="static/images/ad/image.png" class="slogan">
  264. </a>
  265. </div>
  266. <div class="phpcn-mt-10" >
  267. <a href="">
  268. <img src="static/images/ad/ad2.jpg" class="slogan ">
  269. </a>
  270. </div>
  271. </div>
  272. </div>
  273. </div>
  274. </div>
  275. <!--商城开始结束-->
  276. </div>
  277. </div>
  278. <!--友情链接 -->
  279. <div class="phpcn-clear phpcn-mt-30">
  280. <div class="phpcn-main links">
  281. <div class="title-header phpcn-mb-40 phpcn-mt-20"><span>合作网站</span></div>
  282. <div>
  283. <a href="">php中文网</a>
  284. <a href="">百度中国</a>
  285. <a href="">phpstudy</a>
  286. <a href="">php中文网</a>
  287. <a href="">百度中国</a>
  288. <a href="">phpstudy</a>
  289. <a href="">php中文网</a>
  290. <a href="">百度中国</a>
  291. <a href="">phpstudy</a>
  292. <a href="">php中文网</a>
  293. <a href="">百度中国</a>
  294. <a href="">phpstudy</a>
  295. <a href="">php中文网</a>
  296. <a href="">百度中国</a>
  297. <a href="">phpstudy</a>
  298. <a href="">php中文网</a>
  299. <a href="">百度中国</a>
  300. <a href="">phpstudy</a>
  301. <a href="">php中文网</a>
  302. <a href="">百度中国</a>
  303. <a href="">phpstudy</a>
  304. <a href="">php中文网</a>
  305. <a href="">百度中国</a>
  306. <a href="">phpstudy</a>
  307. </div>
  308. </div>
  309. </div>
  310. <!--友情链接结束-->
  311. <!--网站底部-->
  312. <?php include __DIR__ . '/foot.php'; ?>
  313. <!--网站底部-->
  314. <script src="static/js/pin.js"></script>
  315. <script>
  316. var myPi = new Xpcms(".pi", {
  317. type: 1, // 轮播的类型(1渐隐)
  318. automatic: true, //是否自动轮播 (默认false)
  319. autoplay: 2000, //自动轮播毫秒 (默认3000)
  320. hover: true, //鼠标悬停轮播 (默认false)
  321. arrowColor: "yellow", //箭头颜色 (默认绿色)
  322. arrowBackgroundType: 2, //箭头背景类型 (1: 方形, 2:圆形)
  323. arrowBackground: 1, //箭头背景色 (1:白色,2:黑色, 默认:无颜色)
  324. arrowTransparent: 0.2, //箭头背景透明度 (默认: 0.5)
  325. spotColor: "white",//圆点颜色 (默认: 白色)
  326. spotType: 1, //圆点的形状 (默认: 圆形, 1:圆形, 2.矩形)
  327. spotSelectColor: "red", //圆点选中颜色 (默认绿色)
  328. spotTransparent: 0.8, //圆点透明度 (默认0.8)
  329. mousewheel: true, //是否开启鼠标滚动轮播(默认false)
  330. drag: false, //是否开启鼠标拖动 (默认为: true, 如不需要拖动设置false即可)
  331. loop: true, //是否循环轮播 (默认为: false)
  332. });
  333. var progress = $('.phpcn-progress .phpcn-row');
  334. jQuery.each(progress, function(){
  335. //console.log($(this).find('.phpcn-progress-percent').attr('class'));
  336. $(this).find('.phpcn-progress-bor').css('width',$(this).find('.phpcn-progress-percent').html());
  337. });
  338. $('.phpcn-dl dl').last().css('border-bottom','1px solid #C9C9C9');
  339. $('#admin-select').mouseover(function(){
  340. //alert($(this).find('dl').css('display'));
  341. $(this).find('dl').show();
  342. });
  343. $('#admin-select').find('dl').mouseout(function(){
  344. $(this).hide();
  345. });
  346. $('.phpcn-button').mouseover(function(){
  347. $(this).addClass('phpcn-button-hover');
  348. });$('.phpcn-button').mouseout(function(){
  349. $(this).removeClass('phpcn-button-hover');
  350. });
  351. $('.tree').css('min-height',$(document).height()-160);
  352. $('.tree').find('li').click(function(){
  353. //alert($('.tree').find('dl').css('display'));
  354. //$('.tree').find('dl').hide();
  355. if($(this).find('dl').css('display')=='none'){
  356. $(this).find('i').removeClass('phpcn-icon-down');
  357. $(this).find('i').addClass('phpcn-icon-up');
  358. $('.tree').find('dl').hide();
  359. $(this).find('dl').show();
  360. }else{
  361. $(this).find('i').removeClass('phpcn-icon-up');
  362. $(this).find('i').addClass('phpcn-icon-down');
  363. $(this).find('dl').hide();
  364. }
  365. });
  366. //table窗口
  367. $('.tree').find('a').click(function(){
  368. //alert($('.tree').find('dl').css('display'));
  369. //$('.tree').find('dl').hide();
  370. var tabs=$('.phpcn-tab-title a');
  371. tree=$(this);
  372. jQuery.each(tabs, function(){
  373. $('.phpcn-tab-title li').removeClass('on');
  374. if($(this).attr('data')!=tree.attr('data')){
  375. var tabs=$('.phpcn-tab-title ul');
  376. $(this).removeClass('on');
  377. var html='<li class="on"><i></i><dd>'+tree.html()+' <a class="phpcn-icon phpcn-icon-guanbi" data='+tree.attr('data')+' href="javascript:;"></a></dd></li>';
  378. tabs.append(html);
  379. return false;
  380. }
  381. });
  382. });
  383. //table窗口
  384. $('.phpcn-tab-title').find('.phpcn-icon-guanbi').click(function(){
  385. alert();
  386. $(this).parent().parent('li').remove();
  387. });
  388. $('.phpcn-tab-title').find('li').mouseover(function(){
  389. var i=$(this).find('i');
  390. $('.phpcn-tab-title').find('li').find('i').css('width','0%');
  391. if($(this).css('background')!='#f6f6f6'){
  392. $('.phpcn-tab-title').find('li').css('background','none');
  393. $(this).css('background','#f6f6f6');
  394. }
  395. if(i.css('width')!='100%'){
  396. i.css('width','100%');
  397. }
  398. });
  399. </script>
  400. </body>
  401. </html>

商品封面页面

  1. <?php
  2. include __DIR__ . "/head.php";
  3. class shop extends select
  4. {
  5. public function shopList($limit=8){
  6. // 变量$limit控制显示的行数默认10行
  7. $limit='limit '.$limit;
  8. // 图片路径
  9. $imagePath='static/images/shop/';
  10. $sql = 'select `*` from `shop` '. $limit;
  11. $stmt = $this->pdo->prepare($sql);
  12. $stmt->execute();
  13. $article = $stmt->fetchAll(PDO::FETCH_ASSOC);
  14. foreach ($article as $cate)
  15. {
  16. echo '<dd class="phpcn-col-md2">
  17. <a href="shop-content.php?id='.$cate['id'].'"><img src="'.$imagePath.$cate['img'].'"></a>
  18. <a href="shop-content.php?id='.$cate['id'].'">'.$cate['title'].'</a>
  19. <a href="" class="phpcn-mt-10">
  20. <span class="price">'.$cate['price'].'</span>
  21. <span class="tags">美女</span>
  22. </a>
  23. </dd>' ;
  24. }
  25. }
  26. }
  27. $shop1=new shop();
  28. ?>
  29. <div class="phpcn-clear category phpcn-p-20">
  30. <div class="phpcn-main">
  31. <div class="phpcn-col-md12 search">
  32. <div class="phpcn-col-md3">
  33. <a href="">
  34. <img src="static/images/logo.png" class="logo">
  35. </a>
  36. </div>
  37. <div class="phpcn-col-md6">
  38. <ul>
  39. <li>
  40. <a href="" class="on">商品</a>
  41. <a href="">服务商</a>
  42. </li>
  43. <li class="phpcn-clear">
  44. <input type="" name=""><button class="phpcn-button s-btn">搜索</button>
  45. </li>
  46. </ul>
  47. </div>
  48. <div class="phpcn-col-md3">
  49. <button class="phpcn-button phpcn-bg-red">免费入驻</button>
  50. </div>
  51. </div>
  52. <div class="phpcn-col-md12 phpcn-mt-60">
  53. <div class="phpcn-col-md3 all-cat">
  54. 所有产品分类 <i class="phpcn-icon phpcn-icon-liebiao phpcn-r"></i>
  55. </div>
  56. <div class="phpcn-col-md9">
  57. <div class="cat-nav">
  58. <a href="" class="on">首页</a>
  59. <a href="">3c数码</a>
  60. <a href="">生活用品 <span class='phpcn-badge'></span></a>
  61. <a href="">名字名画</a>
  62. </div>
  63. </div>
  64. </div>
  65. <div class="phpcn-col-md3 cat-left">
  66. <ul>
  67. <li>
  68. <h2><a href="">企业软件</a></h2>
  69. <span>
  70. <a href="">微信推广</a>
  71. <a href=""> QQ推广 </a>
  72. <a href=""> 公众号推广 </a>
  73. <a href=""> 淘客软件 </a>
  74. <a href=""> 网络推广</a>
  75. <a href=""> SEO软件</a>
  76. </span>
  77. </li>
  78. <li>
  79. <h2><a href="">企业软件</a></h2>
  80. <span>
  81. <a href="">微信推广</a>
  82. <a href=""> QQ推广 </a>
  83. <a href=""> 公众号推广 </a>
  84. <a href=""> 淘客软件 </a>
  85. <a href=""> 网络推广</a>
  86. <a href=""> SEO软件</a>
  87. </span>
  88. </li>
  89. <li>
  90. <h2><a href="">企业软件</a></h2>
  91. <span>
  92. <a href="">微信推广</a>
  93. <a href=""> QQ推广 </a>
  94. <a href=""> 公众号推广 </a>
  95. <a href=""> 淘客软件 </a>
  96. <a href=""> 网络推广</a>
  97. <a href=""> SEO软件</a>
  98. </span>
  99. </li>
  100. </ul>
  101. </div>
  102. <div class="phpcn-col-md9">
  103. <div class="shop-banner">
  104. <img src="static/images/4.jpg">
  105. </div>
  106. </div>
  107. </div>
  108. </div>
  109. <div class="phpcn-main">
  110. <!--商城开始-->
  111. <div class="phpcn-clear">
  112. <div class="title-header phpcn-mb-40 phpcn-mt-20"><span>名画</span></div>
  113. <div class="home-shop phpcn-clear">
  114. <div class="title "><a href="">抢好货</a> <span>0低价、便捷、安全、快速</span></div>
  115. <div class='head-tags'>
  116. <span>热门分类:</span>
  117. <a href="">美女写真</a>
  118. <a href="">日本美女</a>
  119. <a href="">美国美女</a>
  120. <a href="">国内美女</a>
  121. <a href="">AV美女</a>
  122. </div>
  123. <div class="phpcn-clear">
  124. <div class="phpcn-col-md8">
  125. <dl>
  126. <?php $shop1->shopList(8);?>
  127. </dl>
  128. </div>
  129. <div class="phpcn-col-md4 home-ad">
  130. <ul class="phpcn-clear">
  131. <li class="phpcn-col-md6">
  132. <a href="">
  133. <img src="static/images/ad/1.png">
  134. </a>
  135. </li>
  136. <li class="phpcn-col-md6">
  137. <a href="">
  138. <img src="static/images/ad/2.png">
  139. </a>
  140. </li>
  141. <li class="phpcn-col-md6">
  142. <a href="">
  143. <img src="static/images/ad/3.png">
  144. </a>
  145. </li>
  146. <li class="phpcn-col-md6">
  147. <a href="">
  148. <img src="static/images/ad/4.png">
  149. </a>
  150. </li>
  151. </ul>
  152. <div class="phpcn-mt-10">
  153. <a href="">
  154. <img src="static/images/ad/image.png" class="slogan">
  155. </a>
  156. </div>
  157. <div class="phpcn-mt-10" >
  158. <a href="">
  159. <img src="static/images/ad/ad2.jpg" class="slogan ">
  160. </a>
  161. </div>
  162. </div>
  163. </div>
  164. </div>
  165. <!--商品分类-->
  166. <div class="title-header phpcn-mb-40 phpcn-mt-20"><span>真写</span></div>
  167. <div class="home-shop phpcn-clear">
  168. <div class="title "><a href="">抢好货</a> <span>0低价、便捷、安全、快速</span></div>
  169. <div class='head-tags'>
  170. <span>热门分类:</span>
  171. <a href="">美女写真</a>
  172. <a href="">日本美女</a>
  173. <a href="">美国美女</a>
  174. <a href="">国内美女</a>
  175. <a href="">AV美女</a>
  176. </div>
  177. <div class="phpcn-clear">
  178. <div class="phpcn-col-md12">
  179. <dl>
  180. <?php $shop1->shopList(12);?>
  181. </dl>
  182. </div>
  183. </div>
  184. </div>
  185. <!--商品分类结束--><!--商品分类-->
  186. <div class="title-header phpcn-mb-40 phpcn-mt-20"><span>真写</span></div>
  187. <div class="home-shop phpcn-clear">
  188. <div class="title "><a href="">抢好货</a> <span>0低价、便捷、安全、快速</span></div>
  189. <div class='head-tags'>
  190. <span>热门分类:</span>
  191. <a href="">美女写真</a>
  192. <a href="">日本美女</a>
  193. <a href="">美国美女</a>
  194. <a href="">国内美女</a>
  195. <a href="">AV美女</a>
  196. </div>
  197. <div class="phpcn-clear">
  198. <div class="phpcn-col-md12">
  199. <dl>
  200. <?php $shop1->shopList(12);?>
  201. </dl>
  202. </div>
  203. </div>
  204. </div>
  205. <!--商品分类结束-->
  206. </div>
  207. <!--商城开始结束-->
  208. </div>
  209. </div>
  210. </div>
  211. <!--网站底部-->
  212. <?php include __DIR__ . '/foot.php'; ?>
  213. <!--网站底部-->
  214. <script src="static/js/pin.js"></script>
  215. <script>
  216. var myPi = new Pike(".pi", {
  217. type: 1, // 轮播的类型(1渐隐)
  218. automatic: true, //是否自动轮播 (默认false)
  219. autoplay: 2000, //自动轮播毫秒 (默认3000)
  220. hover: true, //鼠标悬停轮播 (默认false)
  221. arrowColor: "yellow", //箭头颜色 (默认绿色)
  222. arrowBackgroundType: 2, //箭头背景类型 (1: 方形, 2:圆形)
  223. arrowBackground: 1, //箭头背景色 (1:白色,2:黑色, 默认:无颜色)
  224. arrowTransparent: 0.2, //箭头背景透明度 (默认: 0.5)
  225. spotColor: "white",//圆点颜色 (默认: 白色)
  226. spotType: 1, //圆点的形状 (默认: 圆形, 1:圆形, 2.矩形)
  227. spotSelectColor: "red", //圆点选中颜色 (默认绿色)
  228. spotTransparent: 0.8, //圆点透明度 (默认0.8)
  229. mousewheel: true, //是否开启鼠标滚动轮播(默认false)
  230. drag: false, //是否开启鼠标拖动 (默认为: true, 如不需要拖动设置false即可)
  231. loop: true, //是否循环轮播 (默认为: false)
  232. });
  233. var progress = $('.phpcn-progress .phpcn-row');
  234. jQuery.each(progress, function(){
  235. //console.log($(this).find('.phpcn-progress-percent').attr('class'));
  236. $(this).find('.phpcn-progress-bor').css('width',$(this).find('.phpcn-progress-percent').html());
  237. });
  238. $('.phpcn-dl dl').last().css('border-bottom','1px solid #C9C9C9');
  239. $('#admin-select').mouseover(function(){
  240. //alert($(this).find('dl').css('display'));
  241. $(this).find('dl').show();
  242. });
  243. $('#admin-select').find('dl').mouseout(function(){
  244. $(this).hide();
  245. });
  246. $('.phpcn-button').mouseover(function(){
  247. $(this).addClass('phpcn-button-hover');
  248. });$('.phpcn-button').mouseout(function(){
  249. $(this).removeClass('phpcn-button-hover');
  250. });
  251. $('.tree').css('min-height',$(document).height()-160);
  252. $('.tree').find('li').click(function(){
  253. //alert($('.tree').find('dl').css('display'));
  254. //$('.tree').find('dl').hide();
  255. if($(this).find('dl').css('display')=='none'){
  256. $(this).find('i').removeClass('phpcn-icon-down');
  257. $(this).find('i').addClass('phpcn-icon-up');
  258. $('.tree').find('dl').hide();
  259. $(this).find('dl').show();
  260. }else{
  261. $(this).find('i').removeClass('phpcn-icon-up');
  262. $(this).find('i').addClass('phpcn-icon-down');
  263. $(this).find('dl').hide();
  264. }
  265. });
  266. //table窗口
  267. $('.tree').find('a').click(function(){
  268. //alert($('.tree').find('dl').css('display'));
  269. //$('.tree').find('dl').hide();
  270. var tabs=$('.phpcn-tab-title a');
  271. tree=$(this);
  272. jQuery.each(tabs, function(){
  273. $('.phpcn-tab-title li').removeClass('on');
  274. if($(this).attr('data')!=tree.attr('data')){
  275. var tabs=$('.phpcn-tab-title ul');
  276. $(this).removeClass('on');
  277. var html='<li class="on"><i></i><dd>'+tree.html()+' <a class="phpcn-icon phpcn-icon-guanbi" data='+tree.attr('data')+' href="javascript:;"></a></dd></li>';
  278. tabs.append(html);
  279. return false;
  280. }
  281. });
  282. });
  283. //table窗口
  284. $('.phpcn-tab-title').find('.phpcn-icon-guanbi').click(function(){
  285. alert();
  286. $(this).parent().parent('li').remove();
  287. });
  288. $('.phpcn-tab-title').find('li').mouseover(function(){
  289. var i=$(this).find('i');
  290. $('.phpcn-tab-title').find('li').find('i').css('width','0%');
  291. if($(this).css('background')!='#f6f6f6'){
  292. $('.phpcn-tab-title').find('li').css('background','none');
  293. $(this).css('background','#f6f6f6');
  294. }
  295. if(i.css('width')!='100%'){
  296. i.css('width','100%');
  297. }
  298. });
  299. </script>
  300. </body>
  301. </html>

商品详情页面

  1. <?php
  2. include __DIR__ . "/head.php";
  3. //接受url中专来的参数
  4. if (empty($_GET['id'])){
  5. die('参数错误');
  6. }
  7. $a=$_GET['id'];
  8. class shop_content extends Sql_db
  9. {
  10. public $title;
  11. public $img;
  12. public $time;
  13. public $sel;
  14. public $body;
  15. public $price;
  16. public $imgPath='static/images/shop/';
  17. public function __construct()
  18. {
  19. // 链接数据库
  20. $this->pdo= parent::conect(DB_HOST,DB_NAME,DB_USER,DB_PASSWORD);
  21. }
  22. public function shopContent($a=1){
  23. $a='`id`='.$a;
  24. $sql = 'select `*` from `shop` where '.$a;
  25. $stmt = $this->pdo->prepare($sql);
  26. $stmt->execute();
  27. $article = $stmt->fetchAll(PDO::FETCH_ASSOC);
  28. foreach ($article as $cate){
  29. $this->title=$cate['title'];
  30. $this->time=$cate['times'];
  31. $this->sel=$cate['sel'];
  32. $this->body=$cate['body'];
  33. $this->price=$cate['price'];
  34. $this->img=$cate['img'];
  35. }
  36. }
  37. //热销商品
  38. public function hot($limit){
  39. $limit='limit '.$limit;
  40. $sql = 'select `*` from `shop` '.$limit;
  41. $stmt = $this->pdo->prepare($sql);
  42. $stmt->execute();
  43. $article = $stmt->fetchAll(PDO::FETCH_ASSOC);
  44. foreach ($article as $cate){
  45. echo '<li><a href="shop-content.php?id='.$cate['id'].'" ><div class="phpcn-ps-r"> <img src="static/images/shop/'.$cate['img'].'">
  46. <h3>'.$cate['title'].'</span></h3></div><div class="attribute">
  47. <span class="phpcn-l">热销11</span>
  48. <span class="phpcn-r">'.$cate['price'].'</span>
  49. </div>
  50. </a>
  51. </li>';
  52. }
  53. }
  54. }
  55. $shop=new shop_content();
  56. $shop->shopContent($a);
  57. ?>
  58. <div class="phpcn-clear category phpcn-p-20 phpcn-bg-fff" >
  59. <div class="phpcn-main ">
  60. <div class="phpcn-col-md12 search ">
  61. <div class="phpcn-col-md3">
  62. <a href="">
  63. <img src="static/images/logo.png" class="logo">
  64. </a>
  65. </div>
  66. <div class="phpcn-col-md6">
  67. <ul>
  68. <li>
  69. <a href="" class="on">商品</a>
  70. <a href="">服务商</a>
  71. </li>
  72. <li class="phpcn-clear">
  73. <input type="" name=""><button class="phpcn-button s-btn">搜索</button>
  74. </li>
  75. </ul>
  76. </div>
  77. <div class="phpcn-col-md3">
  78. <button class="phpcn-button phpcn-bg-red">免费入驻</button>
  79. </div>
  80. </div>
  81. <div class="phpcn-col-md12 phpcn-mt-60 ">
  82. <div class="phpcn-col-md3 all-cat borb">
  83. 所有产品分类 <i class="phpcn-icon phpcn-icon-liebiao phpcn-r"></i>
  84. </div>
  85. <div class="phpcn-col-md9 ">
  86. <div class="cat-nav borb">
  87. <a href="" class="on">首页</a>
  88. <a href="">3c数码</a>
  89. <a href="">生活用品 <span class='phpcn-badge'></span></a>
  90. <a href="">名字名画</a>
  91. </div>
  92. </div>
  93. </div>
  94. </div>
  95. </div>
  96. <div class="phpcn-clear phpcn-mt-20">
  97. <div class="phpcn-main phpcn-bg-fff ">
  98. <!--商品详情-->
  99. <div class="shop phpcn-p-20">
  100. <div class="path phpcn-clear">
  101. <a href="">首页</a>
  102. <span>->></span>
  103. <a href="">3C数码</a>
  104. <span>->></span>
  105. <a href="">笔记本电脑</a>
  106. <span>->></span>
  107. </div>
  108. <div class="detail phpcn-clear phpcn-mt-30">
  109. <div class="phpcn-col-md4">
  110. <img src="<?php echo $shop->imgPath.$shop->img;?>" class="buy-img">
  111. </div>
  112. <div class="phpcn-col-md8">
  113. <h1><?php echo $shop->title; ?></h1>
  114. <div class="price">
  115. <span>本站特惠</span><strong ><?php echo $shop->price; ?></strong>
  116. </div>
  117. <div class="buy-lieval">
  118. <ul>
  119. <li class="br">销量:<span><?php echo $shop->sel; ?></span></li>
  120. <li class="br">累积评价:<span>0</span></li>
  121. <li>好评率:<span>100%</span></li>
  122. </ul>
  123. </div>
  124. <div class="buy-nums phpcn-clear">
  125. <ul>
  126. <li>购买数量</li>
  127. <li class="phpcn-ps-r">
  128. <input type="text" name="" id="quantity" value="1" size="3" maxlength="6" class="fl" style="border-radius:0;">
  129. <i class="phpcn-icon phpcn-icon-up"></i>
  130. <i class="phpcn-icon phpcn-icon-down"></i>
  131. </li>
  132. </ul>
  133. </div>
  134. <div class="buy-btn phpcn-clear phpcn-mt-20">
  135. <button class="phpcn-button phpcn-bg-red">立即购买</button>
  136. <button class="phpcn-button "><i class="phpcn-icon phpcn-icon-icon_tianjia"></i>加入购物车</button>
  137. </div>
  138. <div class="buy-guarantee phpcn-clear phpcn-mt-20">
  139. <ul>
  140. <li> <i class="phpcn-icon phpcn-icon-zhanghaoquanxianguanli"></i> 本站保障</li>
  141. <li> <i class="phpcn-icon phpcn-icon-icon_safety"></i>企业认证</li>
  142. <li><i class="phpcn-icon phpcn-icon-tianshenpi"></i>退款承诺</li>
  143. <li><i class="phpcn-icon phpcn-icon-kuaisubianpai"></i>免费换货</li>
  144. </ul>
  145. </div>
  146. </div>
  147. </div>
  148. </div>
  149. <!--商品详情结束-->
  150. </div>
  151. </div>
  152. <div class="phpcn-clear phpcn-mt-20">
  153. <div class="phpcn-main shop-conten">
  154. <div class="phpcn-col-md2 ">
  155. <div class="categorymenu phpcn-clear cat-width">
  156. <ul>
  157. <li class="phpcn-col-md6"><a href="">商品详情</a></li>
  158. <li class="phpcn-col-md6"><a href="">案例/演示</a></li>
  159. </ul>
  160. </div>
  161. <div class="shop-left-list">
  162. <ul>
  163. <!-- 根据传递的参数不同可调用不用的商品-->
  164. <?php $shop->hot(5); ?>
  165. </ul>
  166. </div>
  167. </div>
  168. <div class="phpcn-col-md10 ">
  169. <div class="content ">
  170. <div class="categorymenu cat-nav-width">
  171. <ul class="phpcn-clear">
  172. <li class="phpcn-col-md1"><a href="" class="on">商品详情</a></li>
  173. <li class="phpcn-col-md1"><a href="">案例/演示</a></li>
  174. <li class="phpcn-col-md1"><a href="">常见问题</a></li>
  175. <li class="phpcn-col-md1"><a href="">累计评价</a></li>
  176. <li class="phpcn-col-md1"><a href="">产品咨询</a></li>
  177. </ul>
  178. </div>
  179. <article class="phpcn-clear">
  180. <?php echo $shop->body; ?>
  181. </article>
  182. <!--评论--->
  183. <div class="comment phpcn-mt-30 ">
  184. <div class="title phpcn-mb-30"><span>网页评论</span></div>
  185. <div class="phpcn-clear">
  186. <div class="phpcn-col-md1"><img class="user" src="static/images/user.png"> </div>
  187. <div class="phpcn-col-md11">
  188. <textarea>我来评论两句</textarea>
  189. <button class="phpcn-button phpcn-bg-red phpcn-button-hover phpcn-mt-10 phpcn-mb-10 phpcn-r">发表评论</button>
  190. </div>
  191. </div>
  192. <div class="title phpcn-mb-30"><span>最新评论</span></div>
  193. <div class="phpcn-clear">
  194. <div class="phpcn-clear border">
  195. <div class="phpcn-col-md1">
  196. <img class="user" src="static/images/user.png">
  197. </div>
  198. <div class="phpcn-col-md11">
  199. <ul class="phpcn-clear">
  200. <li class="user-naem">
  201. 用户昵称
  202. </li>
  203. <li class="cont">留言内容</li>
  204. <li>
  205. <span>2019-08-08 14:46:05发表</span>
  206. <span class="phpcn-r"><i class="phpcn-icon phpcn-icon-dianzan"></i> <a href="">回复 </a></span>
  207. </li>
  208. </ul>
  209. </div>
  210. </div>
  211. <div class="phpcn-clear border">
  212. <div class="phpcn-col-md1">
  213. <img class="user" src="static/images/user.png">
  214. </div>
  215. <div class="phpcn-col-md11">
  216. <ul class="phpcn-clear">
  217. <li class="user-naem">
  218. 用户昵称
  219. </li>
  220. <li class="cont">留言内容</li>
  221. <li>
  222. <span>2019-08-08 14:46:05发表</span>
  223. <span class="phpcn-r"><i class="phpcn-icon phpcn-icon-dianzan"></i> <a href="">回复 </a></span>
  224. </li>
  225. </ul>
  226. </div>
  227. </div>
  228. <div class="phpcn-clear border">
  229. <div class="phpcn-col-md1">
  230. <img class="user" src="static/images/user.png">
  231. </div>
  232. <div class="phpcn-col-md11">
  233. <ul class="phpcn-clear">
  234. <li class="user-naem">
  235. 用户昵称
  236. </li>
  237. <li class="cont">留言内容</li>
  238. <li>
  239. <span>2019-08-08 14:46:05发表</span>
  240. <span class="phpcn-r"><i class="phpcn-icon phpcn-icon-dianzan"></i> <a href="">回复 </a></span>
  241. </li>
  242. </ul>
  243. </div>
  244. </div>
  245. </div>
  246. <div class="phpcn-clear border">
  247. <div class="phpcn-col-md1">
  248. <img class="user" src="static/images/user.png">
  249. </div>
  250. <div class="phpcn-col-md11">
  251. <ul class="phpcn-clear">
  252. <li class="user-naem">
  253. 用户昵称
  254. </li>
  255. <li class="cont">留言内容</li>
  256. <li>
  257. <span>2019-08-08 14:46:05发表</span>
  258. <span class="phpcn-r"><i class="phpcn-icon phpcn-icon-dianzan"></i> <a href="">回复 </a></span>
  259. </li>
  260. </ul>
  261. </div>
  262. </div>
  263. </div>
  264. <!--评论结束--->
  265. </div>
  266. </div>
  267. </div>
  268. </div>
  269. <!--网站底部-->
  270. <?php include __DIR__ . '/foot.php'; ?>
  271. <!--网站底部-->
  272. <script src="static/js/pin.js"></script>
  273. <script>
  274. var myPi = new Pike(".pi", {
  275. type: 1, // 轮播的类型(1渐隐)
  276. automatic: true, //是否自动轮播 (默认false)
  277. autoplay: 2000, //自动轮播毫秒 (默认3000)
  278. hover: true, //鼠标悬停轮播 (默认false)
  279. arrowColor: "yellow", //箭头颜色 (默认绿色)
  280. arrowBackgroundType: 2, //箭头背景类型 (1: 方形, 2:圆形)
  281. arrowBackground: 1, //箭头背景色 (1:白色,2:黑色, 默认:无颜色)
  282. arrowTransparent: 0.2, //箭头背景透明度 (默认: 0.5)
  283. spotColor: "white",//圆点颜色 (默认: 白色)
  284. spotType: 1, //圆点的形状 (默认: 圆形, 1:圆形, 2.矩形)
  285. spotSelectColor: "red", //圆点选中颜色 (默认绿色)
  286. spotTransparent: 0.8, //圆点透明度 (默认0.8)
  287. mousewheel: true, //是否开启鼠标滚动轮播(默认false)
  288. drag: false, //是否开启鼠标拖动 (默认为: true, 如不需要拖动设置false即可)
  289. loop: true, //是否循环轮播 (默认为: false)
  290. });
  291. var progress = $('.phpcn-progress .phpcn-row');
  292. jQuery.each(progress, function(){
  293. //console.log($(this).find('.phpcn-progress-percent').attr('class'));
  294. $(this).find('.phpcn-progress-bor').css('width',$(this).find('.phpcn-progress-percent').html());
  295. });
  296. $('.phpcn-dl dl').last().css('border-bottom','1px solid #C9C9C9');
  297. $('#admin-select').mouseover(function(){
  298. //alert($(this).find('dl').css('display'));
  299. $(this).find('dl').show();
  300. });
  301. $('#admin-select').find('dl').mouseout(function(){
  302. $(this).hide();
  303. });
  304. $('.phpcn-button').mouseover(function(){
  305. $(this).addClass('phpcn-button-hover');
  306. });$('.phpcn-button').mouseout(function(){
  307. $(this).removeClass('phpcn-button-hover');
  308. });
  309. $('.tree').css('min-height',$(document).height()-160);
  310. $('.tree').find('li').click(function(){
  311. //alert($('.tree').find('dl').css('display'));
  312. //$('.tree').find('dl').hide();
  313. if($(this).find('dl').css('display')=='none'){
  314. $(this).find('i').removeClass('phpcn-icon-down');
  315. $(this).find('i').addClass('phpcn-icon-up');
  316. $('.tree').find('dl').hide();
  317. $(this).find('dl').show();
  318. }else{
  319. $(this).find('i').removeClass('phpcn-icon-up');
  320. $(this).find('i').addClass('phpcn-icon-down');
  321. $(this).find('dl').hide();
  322. }
  323. });
  324. //table窗口
  325. $('.tree').find('a').click(function(){
  326. //alert($('.tree').find('dl').css('display'));
  327. //$('.tree').find('dl').hide();
  328. var tabs=$('.phpcn-tab-title a');
  329. tree=$(this);
  330. jQuery.each(tabs, function(){
  331. $('.phpcn-tab-title li').removeClass('on');
  332. if($(this).attr('data')!=tree.attr('data')){
  333. var tabs=$('.phpcn-tab-title ul');
  334. $(this).removeClass('on');
  335. var html='<li class="on"><i></i><dd>'+tree.html()+' <a class="phpcn-icon phpcn-icon-guanbi" data='+tree.attr('data')+' href="javascript:;"></a></dd></li>';
  336. tabs.append(html);
  337. return false;
  338. }
  339. });
  340. });
  341. //table窗口
  342. $('.phpcn-tab-title').find('.phpcn-icon-guanbi').click(function(){
  343. alert();
  344. $(this).parent().parent('li').remove();
  345. });
  346. $('.phpcn-tab-title').find('li').mouseover(function(){
  347. var i=$(this).find('i');
  348. $('.phpcn-tab-title').find('li').find('i').css('width','0%');
  349. if($(this).css('background')!='#f6f6f6'){
  350. $('.phpcn-tab-title').find('li').css('background','none');
  351. $(this).css('background','#f6f6f6');
  352. }
  353. if(i.css('width')!='100%'){
  354. i.css('width','100%');
  355. }
  356. });
  357. </script>
  358. </body>
  359. </html>

图片封面页

  1. <?php
  2. include __DIR__ . "/head.php";
  3. ?>
  4. <!--顶部结束-->
  5. <style>
  6. .pi{
  7. width: 100%;
  8. height: 310px;
  9. }
  10. </style>
  11. <div class="web-top phpcn-box-s phpcn-clear phpcn-mb-30">
  12. <div class="phpcn-main">
  13. <div class="phpcn-col-md7">
  14. <span class="web-tit">php中文网</span>
  15. <span class="web-name">图片站</span>
  16. </div>
  17. <div class="phpcn-col-md5">
  18. <input type="" name=""> <i class="phpcn-icon phpcn-icon-sousuo2" placeholder='关键字搜索'></i>
  19. </div>
  20. </div>
  21. </div>
  22. <div class="phpcn-main">
  23. <div class="phpcn-clear">
  24. <div class="phpcn-col-md8">
  25. <div class="pi">
  26. <div class="pike">
  27. <?php $selHead->selPic(); ?>
  28. </div>
  29. <div class="pike_prev"></div>
  30. <div class="pike_next"></div>
  31. <div class="pike_spot"></div>
  32. </div>
  33. </div>
  34. <div class="phpcn-col-md4">
  35. <div class="image-right">
  36. <div class="hot-article">
  37. <div class="title"><span>r热闹推荐</span></div>
  38. <ul>
  39. <!-- 根据参数可调用不同的图片-->
  40. <?php $selHead->comments(6); ?>
  41. </ul>
  42. </div>
  43. </div>
  44. </div>
  45. </div>
  46. </div>
  47. <!--图片开始-->
  48. <div class="phpcn-clear phpcn-mt-30" style='background:#eee;'>
  49. <div class="phpcn-main">
  50. <div class="phpcn-clear home-img">
  51. <div class="title-header phpcn-mb-40 phpcn-mt-20"><span>图片专区</span></div>
  52. <div class=" phpcn-clear phpcn-col-space15">
  53. <div class="phpcn-col-md4">
  54. <div class="bg">
  55. <div class="title "><a href="">美女</a> <span>纵观摄影艺术</span></div>
  56. <ul class="phpcn-clear">
  57. <!-- 根据参数可调用不同的图片-->
  58. <?php $selHead->imageChan(1,8); ?>
  59. </ul>
  60. </div>
  61. </div>
  62. <div class="phpcn-col-md4">
  63. <div class="bg">
  64. <div class="title "><a href="">美女</a> <span>纵观摄影艺术</span></div>
  65. <ul class="phpcn-clear">
  66. <!-- 根据参数可调用不同的图片-->
  67. <?php $selHead->imageChan(2,8); ?>
  68. </ul>
  69. </div>
  70. </div>
  71. <div class="phpcn-col-md4">
  72. <div class="bg">
  73. <div class="title "><a href="">美女</a> <span>纵观摄影艺术</span></div>
  74. <ul class="phpcn-clear">
  75. <!-- 根据参数可调用不同的图片-->
  76. <?php $selHead->imageChan(1,8); ?>
  77. </ul>
  78. </div>
  79. </div>
  80. </div>
  81. </div>
  82. </div>
  83. <!--图片开始结束-->
  84. <!--图片开始-->
  85. <div class="phpcn-clear phpcn-mt-30" style='background:#eee;'>
  86. <div class="phpcn-main">
  87. <div class="phpcn-clear home-img">
  88. <div class="title-header phpcn-mb-40 phpcn-mt-20"><span>图片专区</span></div>
  89. <div class=" phpcn-clear phpcn-col-space15">
  90. <div class="phpcn-col-md4">
  91. <div class="bg">
  92. <div class="title "><a href="">美女</a> <span>纵观摄影艺术</span></div>
  93. <ul class="phpcn-clear">
  94. <!-- 根据参数可调用不同的图片-->
  95. <?php $selHead->imageChan(1,4); ?>
  96. </ul>
  97. </div>
  98. </div>
  99. <div class="phpcn-col-md4">
  100. <div class="bg">
  101. <div class="title "><a href="">美女</a> <span>纵观摄影艺术</span></div>
  102. <ul class="phpcn-clear">
  103. <!-- 根据参数可调用不同的图片-->
  104. <?php $selHead->imageChan(2,4); ?>
  105. </ul>
  106. </div>
  107. </div>
  108. <div class="phpcn-col-md4">
  109. <div class="bg">
  110. <div class="title "><a href="">美女</a> <span>纵观摄影艺术</span></div>
  111. <ul class="phpcn-clear">
  112. <!-- 根据参数可调用不同的图片-->
  113. <?php $selHead->imageChan(3,4); ?>
  114. </ul>
  115. </div>
  116. </div>
  117. </div>
  118. </div>
  119. </div>
  120. <!--图片开始结束-->
  121. <!--网站底部-->
  122. <?php include __DIR__ . '/foot.php'; ?>
  123. <!--网站底部-->
  124. <script src="static/js/pin.js"></script>
  125. <script>
  126. var myPi = new Pike(".pi", {
  127. type: 1, // 轮播的类型(1渐隐)
  128. automatic: true, //是否自动轮播 (默认false)
  129. autoplay: 2000, //自动轮播毫秒 (默认3000)
  130. hover: true, //鼠标悬停轮播 (默认false)
  131. arrowColor: "yellow", //箭头颜色 (默认绿色)
  132. arrowBackgroundType: 2, //箭头背景类型 (1: 方形, 2:圆形)
  133. arrowBackground: 1, //箭头背景色 (1:白色,2:黑色, 默认:无颜色)
  134. arrowTransparent: 0.2, //箭头背景透明度 (默认: 0.5)
  135. spotColor: "white",//圆点颜色 (默认: 白色)
  136. spotType: 1, //圆点的形状 (默认: 圆形, 1:圆形, 2.矩形)
  137. spotSelectColor: "red", //圆点选中颜色 (默认绿色)
  138. spotTransparent: 0.8, //圆点透明度 (默认0.8)
  139. mousewheel: true, //是否开启鼠标滚动轮播(默认false)
  140. drag: false, //是否开启鼠标拖动 (默认为: true, 如不需要拖动设置false即可)
  141. loop: true, //是否循环轮播 (默认为: false)
  142. });
  143. var progress = $('.phpcn-progress .phpcn-row');
  144. jQuery.each(progress, function(){
  145. //console.log($(this).find('.phpcn-progress-percent').attr('class'));
  146. $(this).find('.phpcn-progress-bor').css('width',$(this).find('.phpcn-progress-percent').html());
  147. });
  148. $('.phpcn-dl dl').last().css('border-bottom','1px solid #C9C9C9');
  149. $('#admin-select').mouseover(function(){
  150. //alert($(this).find('dl').css('display'));
  151. $(this).find('dl').show();
  152. });
  153. $('#admin-select').find('dl').mouseout(function(){
  154. $(this).hide();
  155. });
  156. $('.phpcn-button').mouseover(function(){
  157. $(this).addClass('phpcn-button-hover');
  158. });$('.phpcn-button').mouseout(function(){
  159. $(this).removeClass('phpcn-button-hover');
  160. });
  161. $('.tree').css('min-height',$(document).height()-160);
  162. $('.tree').find('li').click(function(){
  163. //alert($('.tree').find('dl').css('display'));
  164. //$('.tree').find('dl').hide();
  165. if($(this).find('dl').css('display')=='none'){
  166. $(this).find('i').removeClass('phpcn-icon-down');
  167. $(this).find('i').addClass('phpcn-icon-up');
  168. $('.tree').find('dl').hide();
  169. $(this).find('dl').show();
  170. }else{
  171. $(this).find('i').removeClass('phpcn-icon-up');
  172. $(this).find('i').addClass('phpcn-icon-down');
  173. $(this).find('dl').hide();
  174. }
  175. });
  176. //table窗口
  177. $('.tree').find('a').click(function(){
  178. //alert($('.tree').find('dl').css('display'));
  179. //$('.tree').find('dl').hide();
  180. var tabs=$('.phpcn-tab-title a');
  181. tree=$(this);
  182. jQuery.each(tabs, function(){
  183. $('.phpcn-tab-title li').removeClass('on');
  184. if($(this).attr('data')!=tree.attr('data')){
  185. var tabs=$('.phpcn-tab-title ul');
  186. $(this).removeClass('on');
  187. var html='<li class="on"><i></i><dd>'+tree.html()+' <a class="phpcn-icon phpcn-icon-guanbi" data='+tree.attr('data')+' href="javascript:;"></a></dd></li>';
  188. tabs.append(html);
  189. return false;
  190. }
  191. });
  192. });
  193. //table窗口
  194. $('.phpcn-tab-title').find('.phpcn-icon-guanbi').click(function(){
  195. alert();
  196. $(this).parent().parent('li').remove();
  197. });
  198. $('.phpcn-tab-title').find('li').mouseover(function(){
  199. var i=$(this).find('i');
  200. $('.phpcn-tab-title').find('li').find('i').css('width','0%');
  201. if($(this).css('background')!='#f6f6f6'){
  202. $('.phpcn-tab-title').find('li').css('background','none');
  203. $(this).css('background','#f6f6f6');
  204. }
  205. if(i.css('width')!='100%'){
  206. i.css('width','100%');
  207. }
  208. });
  209. </script>
  210. </body>
  211. </html>

图片详情页

  1. <?php
  2. include __DIR__ . "/head.php";
  3. if (empty($_GET['id'])){
  4. die('参数错误');
  5. }
  6. $a=$_GET['id'];
  7. class shopImg extends select{
  8. public $title;
  9. public $img;
  10. public function __construct()
  11. {
  12. // 调用父类方法链接数据库
  13. $this->pdo= parent::conect(DB_HOST,DB_NAME,DB_USER,DB_PASSWORD);
  14. }
  15. public function selImg($a=1){
  16. $a='`id`='.$a;
  17. $sql = 'select `*` from `images` where '.$a;
  18. $stmt = $this->pdo->prepare($sql);
  19. $stmt->execute();
  20. $article = $stmt->fetchAll(PDO::FETCH_ASSOC);
  21. foreach ($article as $cate){
  22. $this->title=$cate['titlename'];
  23. $this->img=$cate['imageurl'];
  24. }
  25. }
  26. }
  27. $art=new shopImg();
  28. $art->selImg($a);
  29. ?>
  30. <!--顶部结束-->
  31. <style>
  32. .pi{
  33. width: 100%;
  34. height: 310px;
  35. }
  36. </style>
  37. <div class="web-top phpcn-box-s phpcn-clear phpcn-mb-30">
  38. <div class="phpcn-main">
  39. <div class="phpcn-col-md7">
  40. <span class="web-tit">php中文网</span>
  41. <span class="web-name">图片站</span>
  42. </div>
  43. <div class="phpcn-col-md5">
  44. <input type="" name=""> <i class="phpcn-icon phpcn-icon-sousuo2" placeholder='关键字搜索'></i>
  45. </div>
  46. </div>
  47. </div>
  48. <div class="phpcn-main ">
  49. <div class="images">
  50. <h1><?php echo $art->title;?></h1>
  51. <div class="cont">
  52. <div class="box">
  53. <!-- 存放大图的容器-->
  54. <div class="all">
  55. <div class="top-img">
  56. <div class="activeimg">
  57. <?php echo ' <img src="static/images/'. $art->img.'">';?>
  58. </div>
  59. <div class="left"><img src="static/images/left.png"> </div>
  60. <div class="right"><img src="static/images/right.png"></div>
  61. </div>
  62. <!-- 存放缩略图的容器-->
  63. <div class="bot-img">
  64. <ul>
  65. <li class="active"><img src="static/images/1.jpg"> </li>
  66. <li><img src="static/images/2.jpg"> </li>
  67. <li><img src="static/images/3.jpg"> </li>
  68. <li><img src="static/images/4.jpg"> </li>
  69. </ul>
  70. </div>
  71. </div>
  72. </div>
  73. </div>
  74. </div>
  75. <!--评论--->
  76. <div class="comment phpcn-mt-30 ">
  77. <div class="title phpcn-mb-30"><span>网页评论</span></div>
  78. <div class="phpcn-clear">
  79. <div class="phpcn-col-md1"><img class="user" src="static/images/user.png"> </div>
  80. <div class="phpcn-col-md11">
  81. <textarea>我来评论两句</textarea>
  82. <button class="phpcn-button phpcn-bg-red phpcn-button-hover phpcn-mt-10 phpcn-mb-10 phpcn-r">发表评论</button>
  83. </div>
  84. </div>
  85. <div class="title phpcn-mb-30"><span>最新评论</span></div>
  86. <div class="phpcn-clear">
  87. <div class="phpcn-clear border">
  88. <div class="phpcn-col-md1">
  89. <img class="user" src="static/images/user.png">
  90. </div>
  91. <div class="phpcn-col-md11">
  92. <ul class="phpcn-clear">
  93. <li class="user-naem">
  94. 用户昵称
  95. </li>
  96. <li class="cont">留言内容</li>
  97. <li>
  98. <span>2019-08-08 14:46:05发表</span>
  99. <span class="phpcn-r"><i class="phpcn-icon phpcn-icon-dianzan"></i> <a href="">回复 </a></span>
  100. </li>
  101. </ul>
  102. </div>
  103. </div>
  104. <div class="phpcn-clear border">
  105. <div class="phpcn-col-md1">
  106. <img class="user" src="static/images/user.png">
  107. </div>
  108. <div class="phpcn-col-md11">
  109. <ul class="phpcn-clear">
  110. <li class="user-naem">
  111. 用户昵称
  112. </li>
  113. <li class="cont">留言内容</li>
  114. <li>
  115. <span>2019-08-08 14:46:05发表</span>
  116. <span class="phpcn-r"><i class="phpcn-icon phpcn-icon-dianzan"></i> <a href="">回复 </a></span>
  117. </li>
  118. </ul>
  119. </div>
  120. </div>
  121. <div class="phpcn-clear border">
  122. <div class="phpcn-col-md1">
  123. <img class="user" src="static/images/user.png">
  124. </div>
  125. <div class="phpcn-col-md11">
  126. <ul class="phpcn-clear">
  127. <li class="user-naem">
  128. 用户昵称
  129. </li>
  130. <li class="cont">留言内容</li>
  131. <li>
  132. <span>2019-08-08 14:46:05发表</span>
  133. <span class="phpcn-r"><i class="phpcn-icon phpcn-icon-dianzan"></i> <a href="">回复 </a></span>
  134. </li>
  135. </ul>
  136. </div>
  137. </div>
  138. </div>
  139. <div class="phpcn-clear border">
  140. <div class="phpcn-col-md1">
  141. <img class="user" src="static/images/user.png">
  142. </div>
  143. <div class="phpcn-col-md11">
  144. <ul class="phpcn-clear">
  145. <li class="user-naem">
  146. 用户昵称
  147. </li>
  148. <li class="cont">留言内容</li>
  149. <li>
  150. <span>2019-08-08 14:46:05发表</span>
  151. <span class="phpcn-r"><i class="phpcn-icon phpcn-icon-dianzan"></i> <a href="">回复 </a></span>
  152. </li>
  153. </ul>
  154. </div>
  155. </div>
  156. </div>
  157. <!--评论结束--->
  158. </div>
  159. <!--网站底部-->
  160. <script src="static/js/pin.js"></script>
  161. <script>
  162. $(function(){
  163. $('.bot-img ul li').click(function(){
  164. var _this=$(this);
  165. _this.addClass('active').siblings('li').removeClass('active');
  166. var int=_this.index();
  167. $('.activeimg').animate({left:int*-500},"slow");
  168. });
  169. var list=$('.bot-img ul li').length;
  170. $('.activeimg').css({
  171. width:list*500,
  172. });
  173. $('.right').click(function(){
  174. next(list)
  175. })
  176. $('.left').click(function(){
  177. prev(list)
  178. });
  179. //自动播放 2秒播放一次 无限循环
  180. var timer='';
  181. var num=0;
  182. timer=setInterval(function(){ //打开定时器
  183. num++;
  184. if(num>parseFloat(list)-1){
  185. num=0;
  186. $('.activeimg').animate({left:num*-500},"slow");
  187. }else{
  188. $('.activeimg').animate({left:num*-500},"slow");
  189. }
  190. },2000);
  191. })
  192. var index=0;
  193. //下一张
  194. function next(list){
  195. if(index<list-1){
  196. index++;
  197. $('.activeimg').animate({left:index*-500},"slow");
  198. $('.bot-img ul li').eq(index).addClass('active').siblings('li').removeClass('active')
  199. }else{
  200. index=0;
  201. $('.activeimg').animate({left:index*-522},"slow");
  202. $('.bot-img ul li').eq(index).addClass('active').siblings('li').removeClass('active')
  203. }
  204. }
  205. // 上一张
  206. function prev(list){
  207. index--;
  208. if(index<0){
  209. index=list-1;
  210. $('.activeimg').animate({left:index*-500},"slow");
  211. $('.bot-img ul li').eq(index).addClass('active').siblings('li').removeClass('active')
  212. }else{
  213. $('.activeimg').animate({left:index*-500},"slow");
  214. $('.bot-img ul li').eq(index).addClass('active').siblings('li').removeClass('active')
  215. }
  216. }
  217. var myPi = new Pike(".pi", {
  218. type: 1, // 轮播的类型(1渐隐)
  219. automatic: true, //是否自动轮播 (默认false)
  220. autoplay: 2000, //自动轮播毫秒 (默认3000)
  221. hover: true, //鼠标悬停轮播 (默认false)
  222. arrowColor: "yellow", //箭头颜色 (默认绿色)
  223. arrowBackgroundType: 2, //箭头背景类型 (1: 方形, 2:圆形)
  224. arrowBackground: 1, //箭头背景色 (1:白色,2:黑色, 默认:无颜色)
  225. arrowTransparent: 0.2, //箭头背景透明度 (默认: 0.5)
  226. spotColor: "white",//圆点颜色 (默认: 白色)
  227. spotType: 1, //圆点的形状 (默认: 圆形, 1:圆形, 2.矩形)
  228. spotSelectColor: "red", //圆点选中颜色 (默认绿色)
  229. spotTransparent: 0.8, //圆点透明度 (默认0.8)
  230. mousewheel: true, //是否开启鼠标滚动轮播(默认false)
  231. drag: false, //是否开启鼠标拖动 (默认为: true, 如不需要拖动设置false即可)
  232. loop: true, //是否循环轮播 (默认为: false)
  233. });
  234. </script>
  235. </body>
  236. </html>

文章列表页面

  1. <?php
  2. include __DIR__ . "/head.php";
  3. ?>
  4. <!--新闻内容头部分类-->
  5. <div class="ar-head phpcn-main">
  6. <div class='phpcn-col-md10 path'>
  7. <a href=""><img src="static/images/ar-logo.png"></a>
  8. <a href="">财经</a>
  9. <span>></span>
  10. <span>列表</span>
  11. </div>
  12. <div class='phpcn-col-md2'>
  13. <input type="" name=""> <i class="phpcn-icon phpcn-icon-sousuo2" placeholder='关键字搜索'></i>
  14. </div>
  15. <div class="phpcn-clear">
  16. <div class="phpcn-col-md9">
  17. <div class="article-content">
  18. <!--列表开始-->
  19. <div class="alist">
  20. <div class="nav phpcn-mt-20">
  21. <a href="">头条 </a>
  22. <a href="">热文 </a>
  23. <a href="">直播 </a>
  24. <a href="" class="on">新闻 </a>
  25. <a href="">政策地图 </a>
  26. <a href="">相对论 </a>
  27. <a href="">人物 </a>
  28. <a href="">行情 </a>
  29. <a href="">投研</a>
  30. <a href="">技术</a>
  31. <a href="">百科</a>
  32. </div>
  33. <div class="aritcle-list">
  34. <!-- 文章资讯页列表-->
  35. <?php $selHead->listSel(); ?>
  36. </div>
  37. </div>
  38. <!--列表开始结束-->
  39. <!--推荐阅读 --->
  40. <div class="about-read phpcn-mt-30 phpcn-clear">
  41. <div class="title"><span>推荐阅读</span></div>
  42. <ul>
  43. <!--推荐阅读-->
  44. <?php $selHead->reading(6); ?>
  45. </ul>
  46. </div>
  47. <!--推荐阅读 结束--->
  48. </div>
  49. </div>
  50. <div class="phpcn-col-md3">
  51. <div class="hot-article">
  52. <div class="title"><span>网页评论</span></div>
  53. <ul>
  54. <!-- 文章右侧内容-->
  55. <?php $selHead->comments(6) ?>
  56. </ul>
  57. </div>
  58. <div class="hot-article phpcn-mt-30">
  59. <div class="title"><span>网页评论</span></div>
  60. <ul>
  61. <!-- 文章右侧内容-->
  62. <?php $selHead->comments(6) ?>
  63. </ul>
  64. </div>
  65. </div>
  66. </div>
  67. </div>
  68. <!--新闻内容头部分类结束-->
  69. <!--网站底部-->
  70. <?php include __DIR__ . '/foot.php'; ?>
  71. <!--网站底部-->
  72. <script src="static/js/pin.js"></script>
  73. <script>
  74. var myPi = new Pike(".pi", {
  75. type: 1, // 轮播的类型(1渐隐)
  76. automatic: true, //是否自动轮播 (默认false)
  77. autoplay: 2000, //自动轮播毫秒 (默认3000)
  78. hover: true, //鼠标悬停轮播 (默认false)
  79. arrowColor: "yellow", //箭头颜色 (默认绿色)
  80. arrowBackgroundType: 2, //箭头背景类型 (1: 方形, 2:圆形)
  81. arrowBackground: 1, //箭头背景色 (1:白色,2:黑色, 默认:无颜色)
  82. arrowTransparent: 0.2, //箭头背景透明度 (默认: 0.5)
  83. spotColor: "white",//圆点颜色 (默认: 白色)
  84. spotType: 1, //圆点的形状 (默认: 圆形, 1:圆形, 2.矩形)
  85. spotSelectColor: "red", //圆点选中颜色 (默认绿色)
  86. spotTransparent: 0.8, //圆点透明度 (默认0.8)
  87. mousewheel: true, //是否开启鼠标滚动轮播(默认false)
  88. drag: false, //是否开启鼠标拖动 (默认为: true, 如不需要拖动设置false即可)
  89. loop: true, //是否循环轮播 (默认为: false)
  90. });
  91. var progress = $('.phpcn-progress .phpcn-row');
  92. jQuery.each(progress, function(){
  93. //console.log($(this).find('.phpcn-progress-percent').attr('class'));
  94. $(this).find('.phpcn-progress-bor').css('width',$(this).find('.phpcn-progress-percent').html());
  95. });
  96. $('.phpcn-dl dl').last().css('border-bottom','1px solid #C9C9C9');
  97. $('#admin-select').mouseover(function(){
  98. //alert($(this).find('dl').css('display'));
  99. $(this).find('dl').show();
  100. });
  101. $('#admin-select').find('dl').mouseout(function(){
  102. $(this).hide();
  103. });
  104. $('.phpcn-button').mouseover(function(){
  105. $(this).addClass('phpcn-button-hover');
  106. });$('.phpcn-button').mouseout(function(){
  107. $(this).removeClass('phpcn-button-hover');
  108. });
  109. $('.tree').css('min-height',$(document).height()-160);
  110. $('.tree').find('li').click(function(){
  111. //alert($('.tree').find('dl').css('display'));
  112. //$('.tree').find('dl').hide();
  113. if($(this).find('dl').css('display')=='none'){
  114. $(this).find('i').removeClass('phpcn-icon-down');
  115. $(this).find('i').addClass('phpcn-icon-up');
  116. $('.tree').find('dl').hide();
  117. $(this).find('dl').show();
  118. }else{
  119. $(this).find('i').removeClass('phpcn-icon-up');
  120. $(this).find('i').addClass('phpcn-icon-down');
  121. $(this).find('dl').hide();
  122. }
  123. });
  124. //table窗口
  125. $('.tree').find('a').click(function(){
  126. //alert($('.tree').find('dl').css('display'));
  127. //$('.tree').find('dl').hide();
  128. var tabs=$('.phpcn-tab-title a');
  129. tree=$(this);
  130. jQuery.each(tabs, function(){
  131. $('.phpcn-tab-title li').removeClass('on');
  132. if($(this).attr('data')!=tree.attr('data')){
  133. var tabs=$('.phpcn-tab-title ul');
  134. $(this).removeClass('on');
  135. var html='<li class="on"><i></i><dd>'+tree.html()+' <a class="phpcn-icon phpcn-icon-guanbi" data='+tree.attr('data')+' href="javascript:;"></a></dd></li>';
  136. tabs.append(html);
  137. return false;
  138. }
  139. });
  140. });
  141. //table窗口
  142. $('.phpcn-tab-title').find('.phpcn-icon-guanbi').click(function(){
  143. alert();
  144. $(this).parent().parent('li').remove();
  145. });
  146. $('.phpcn-tab-title').find('li').mouseover(function(){
  147. var i=$(this).find('i');
  148. $('.phpcn-tab-title').find('li').find('i').css('width','0%');
  149. if($(this).css('background')!='#f6f6f6'){
  150. $('.phpcn-tab-title').find('li').css('background','none');
  151. $(this).css('background','#f6f6f6');
  152. }
  153. if(i.css('width')!='100%'){
  154. i.css('width','100%');
  155. }
  156. });
  157. </script>
  158. </body>
  159. </html>

文章内容页面

  1. <?php
  2. include __DIR__ . "/head.php";
  3. if (empty($_GET['id'])){
  4. die('参数错误');
  5. }
  6. $a=$_GET['id'];
  7. //文章内容页
  8. class article extends select{
  9. public $title;
  10. public $time;
  11. public $read;
  12. public $body;
  13. public function __construct()
  14. {
  15. // 调用父类方法链接数据库
  16. $this->pdo= parent::conect(DB_HOST,DB_NAME,DB_USER,DB_PASSWORD);
  17. }
  18. public function article($a=1){
  19. $a='`id`='.$a;
  20. $sql = 'select `*` from `article` where '.$a;
  21. $stmt = $this->pdo->prepare($sql);
  22. $stmt->execute();
  23. $article = $stmt->fetchAll(PDO::FETCH_ASSOC);
  24. // 得到文章的基本信息本赋值给相应变量,在内容中直接访问变量就行
  25. foreach ($article as $cate){
  26. $this->title=$cate['title'];
  27. $this->time=$cate['times'];
  28. $this->read=$cate['click'];
  29. $this->body=$cate['body'];
  30. }
  31. }
  32. }
  33. $art=new article();
  34. $art->article($a);
  35. ?>
  36. <!--新闻内容头部分类-->
  37. <div class="ar-head phpcn-main">
  38. <div class='phpcn-col-md10 path'>
  39. <a href=""><img src="static/images/ar-logo.png"></a>
  40. <a href="">财经</a>
  41. <span>></span>
  42. <span>正文</span>
  43. </div>
  44. <div class='phpcn-col-md2'>
  45. <input type="" name=""> <i class="phpcn-icon phpcn-icon-sousuo2" placeholder='关键字搜索'></i>
  46. </div>
  47. <div class="phpcn-clear">
  48. <div class="phpcn-col-md9">
  49. <div class="article-content">
  50. <!-- 标题-->
  51. <h1> <?php echo $art->title; ?></h1>
  52. <div class="attribute">
  53. <span>发布时间:<?php echo $art->time;?></span>
  54. <span>来源:北京 青年报</span>
  55. <span>阅读量:<?php echo $art->read;?></span>
  56. <span>评论数:1545</span>
  57. </div>
  58. <article >
  59. <!-- 内容-->
  60. <?php echo $art->body; ?>
  61. </article>
  62. <div class="suggest">
  63. <button class="phpcn-button phpcn-bg-red phpcn-button-hover"></button>
  64. <button class="phpcn-button phpcn-color-grayphpcn-button-hover"></button>
  65. </div>
  66. <!--评论--->
  67. <div class="comment phpcn-mt-30">
  68. <div class="title phpcn-mb-30"><span>网页评论</span></div>
  69. <div class="phpcn-clear">
  70. <div class="phpcn-col-md1"><img class="user" src="static/images/user.png"> </div>
  71. <div class="phpcn-col-md11">
  72. <textarea>
  73. 我来评论两句
  74. </textarea>
  75. <button class="phpcn-button phpcn-bg-red phpcn-button-hover phpcn-mt-10 phpcn-mb-10 phpcn-r">发表评论</button>
  76. </div>
  77. </div>
  78. </div>
  79. <!--评论结束--->
  80. <!--推荐阅读 --->
  81. <div class="about-read phpcn-mt-30">
  82. <div class="title"><span>推荐阅读</span></div>
  83. <ul>
  84. <?php $selHead->reading(6); ?>
  85. </ul>
  86. </div>
  87. <!--推荐阅读 结束--->
  88. </div>
  89. </div>
  90. <div class="phpcn-col-md3">
  91. <div class="hot-article">
  92. <div class="title"><span>网页评论</span></div>
  93. <ul>
  94. <?php $selHead->comments(6) ?>
  95. </ul>
  96. </div>
  97. <div class="hot-article phpcn-mt-30">
  98. <div class="title"><span>网页评论</span></div>
  99. <ul>
  100. <?php $selHead->comments(6) ?>
  101. </ul>
  102. </div>
  103. </div>
  104. </div>
  105. </div>
  106. <!--新闻内容头部分类结束-->
  107. <!--网站底部-->
  108. <?php include __DIR__ . '/foot.php'; ?>
  109. <!--网站底部-->
  110. <script src="static/js/pin.js"></script>
  111. <script>
  112. var myPi = new Pike(".pi", {
  113. type: 1, // 轮播的类型(1渐隐)
  114. automatic: true, //是否自动轮播 (默认false)
  115. autoplay: 2000, //自动轮播毫秒 (默认3000)
  116. hover: true, //鼠标悬停轮播 (默认false)
  117. arrowColor: "yellow", //箭头颜色 (默认绿色)
  118. arrowBackgroundType: 2, //箭头背景类型 (1: 方形, 2:圆形)
  119. arrowBackground: 1, //箭头背景色 (1:白色,2:黑色, 默认:无颜色)
  120. arrowTransparent: 0.2, //箭头背景透明度 (默认: 0.5)
  121. spotColor: "white",//圆点颜色 (默认: 白色)
  122. spotType: 1, //圆点的形状 (默认: 圆形, 1:圆形, 2.矩形)
  123. spotSelectColor: "red", //圆点选中颜色 (默认绿色)
  124. spotTransparent: 0.8, //圆点透明度 (默认0.8)
  125. mousewheel: true, //是否开启鼠标滚动轮播(默认false)
  126. drag: false, //是否开启鼠标拖动 (默认为: true, 如不需要拖动设置false即可)
  127. loop: true, //是否循环轮播 (默认为: false)
  128. });
  129. var progress = $('.phpcn-progress .phpcn-row');
  130. jQuery.each(progress, function(){
  131. //console.log($(this).find('.phpcn-progress-percent').attr('class'));
  132. $(this).find('.phpcn-progress-bor').css('width',$(this).find('.phpcn-progress-percent').html());
  133. });
  134. $('.phpcn-dl dl').last().css('border-bottom','1px solid #C9C9C9');
  135. $('#admin-select').mouseover(function(){
  136. //alert($(this).find('dl').css('display'));
  137. $(this).find('dl').show();
  138. });
  139. $('#admin-select').find('dl').mouseout(function(){
  140. $(this).hide();
  141. });
  142. $('.phpcn-button').mouseover(function(){
  143. $(this).addClass('phpcn-button-hover');
  144. });$('.phpcn-button').mouseout(function(){
  145. $(this).removeClass('phpcn-button-hover');
  146. });
  147. $('.tree').css('min-height',$(document).height()-160);
  148. $('.tree').find('li').click(function(){
  149. //alert($('.tree').find('dl').css('display'));
  150. //$('.tree').find('dl').hide();
  151. if($(this).find('dl').css('display')=='none'){
  152. $(this).find('i').removeClass('phpcn-icon-down');
  153. $(this).find('i').addClass('phpcn-icon-up');
  154. $('.tree').find('dl').hide();
  155. $(this).find('dl').show();
  156. }else{
  157. $(this).find('i').removeClass('phpcn-icon-up');
  158. $(this).find('i').addClass('phpcn-icon-down');
  159. $(this).find('dl').hide();
  160. }
  161. });
  162. //table窗口
  163. $('.tree').find('a').click(function(){
  164. //alert($('.tree').find('dl').css('display'));
  165. //$('.tree').find('dl').hide();
  166. var tabs=$('.phpcn-tab-title a');
  167. tree=$(this);
  168. jQuery.each(tabs, function(){
  169. $('.phpcn-tab-title li').removeClass('on');
  170. if($(this).attr('data')!=tree.attr('data')){
  171. var tabs=$('.phpcn-tab-title ul');
  172. $(this).removeClass('on');
  173. var html='<li class="on"><i></i><dd>'+tree.html()+' <a class="phpcn-icon phpcn-icon-guanbi" data='+tree.attr('data')+' href="javascript:;"></a></dd></li>';
  174. tabs.append(html);
  175. return false;
  176. }
  177. });
  178. });
  179. //table窗口
  180. $('.phpcn-tab-title').find('.phpcn-icon-guanbi').click(function(){
  181. alert();
  182. $(this).parent().parent('li').remove();
  183. });
  184. $('.phpcn-tab-title').find('li').mouseover(function(){
  185. var i=$(this).find('i');
  186. $('.phpcn-tab-title').find('li').find('i').css('width','0%');
  187. if($(this).css('background')!='#f6f6f6'){
  188. $('.phpcn-tab-title').find('li').css('background','none');
  189. $(this).css('background','#f6f6f6');
  190. }
  191. if(i.css('width')!='100%'){
  192. i.css('width','100%');
  193. }
  194. });
  195. </script>
  196. </body>
  197. </html>

文章表

图片表

商品表

栏目表

总结

本次作业刚开始感觉还不知道怎么下手,但慢慢写起来感觉还是不难,在一步步的改进中还是能达到实现的效果,思路应该一直都有只是以前不知道如何从数据库中调出数据并渲染出来,然后经过一学习现在还是没得问题了。但还是有不足的地方 就是感觉现在我用的渲染方法应该不好很不便于后期的功能扩展和维护,如果 再复杂一点的数据渲染估计就找不到方法和思路。

声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议