Home  >  Article  >  Backend Development  >  求按照CI框架分离html页面

求按照CI框架分离html页面

WBOY
WBOYOriginal
2016-06-23 14:13:061066browse

在网上找了一个移序的功能,但是代码是php、mysql、html混搭的,现在用的是CI框架,刚接触框架不久,不会分离,请各位帮忙照着CI框架的模式分离这个页面
数据库页面:class_moder.php
处理页面:admin.php
html页面:sort.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>实现新闻的上移下移功能</title> </head>   <body> <style> *{font-size:12px;} td{height:24px; line-height:24px; text-align:center} </style>   <?php header("Content-type:text/html;charset=gb2312"); include("mysql.class.php"); $conn=new mysql("localhost","root","root","test"," ","gbk"); if(!emptyempty($_GET["weight"])){     if($_GET["move"]=="up"){         //获取上一条新闻信息         $query=$conn->query("select * from `article` where `weight` > '$_GET[weight]' order by `weight` asc limit 1");         if($conn->db_num_rows(query)>0){             $rows=$conn->fetch_array($query);             $conn->query("update `article` set `weight`='$rows[weight]' where `weight`='$_GET[weight]'");             $conn->query("update `article` set `weight`='$_GET[weight]' where `ID`='$rows[ID]'");         }else{             echo "<script>alert('已经在最顶上');</script>";         }     }else if($_GET["move"]=="down"){         //获取下一条新闻信息         $query=$conn->query("select * from `article` where `weight` < '$_GET[weight]' order by `weight` desc limit 1");         if($conn->db_num_rows(query)>0){             $rows=$conn->fetch_array($query);             $conn->query("update `article` set `weight`='$rows[weight]' where `weight`='$_GET[weight]'");             $conn->query("update `article` set `weight`='$_GET[weight]' where `ID`='$rows[ID]'");         }else{             echo "<script>alert('已经在最底下');</script>";         }     } } ?> <table border="1" cellpadding="0" cellspacing="0" width="300" align="center">         <caption>文章上下移动</caption>         <tr>             <td>ID</td><td>标题</td><td>移动</td>         </tr> <?php $query=$conn->query("select * from `article` order by `weight` desc"); if($conn->db_num_rows($query)>0){ while($rows=$conn->fetch_array($query)){     $aid[].=$rows["ID"]; ?>         <tr>             <td><?php echo $rows["ID"]?></td>             <td><?php echo $rows["title"]?></td>             <td><a href="<?php $PHP_SELF?>?weight=<?php echo $rows[weight]?>&move=up">上移</a>/<a href="<?php $PHP_SELF?>?weight=<?php echo $rows[weight]?>&move=down">下移</a></td>         </tr>   <?php     } } ?>     </table> </body> </html>


回复讨论(解决方案)

这个……CI的官方文档里有完整示例看过就知道怎么分了

看过文档,知道怎么弄了

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn