求按照CI架構分離html頁面
在網上找了一個移序的功能,但是代碼是php、mysql、html混搭的,現在用的是CI架構,剛接觸架構不久,不會分離,請各位幫忙照著CI架構的模式分離這個頁面
資料庫頁面:class_moder.php
處理頁面:admin.php
html頁面:sort.html
實現新聞的上移下移功能
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 "";
}
}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 "";
}
}
}
?>