热搜:NVER node 开发 php

求按照CI框架分离html页面

2024-09-15 12:10:01
求按照CI框架分离html页面

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

    实现新闻的上移下移功能        <?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 "";         }     }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 "";         }     } } ?>  <?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"]; ?>            <?php     } } ?>     
文章上下移动
ID标题移动
<?php echo $rows["ID"]?> <?php echo $rows["title"]?> ?weight=<?php echo $rows[weight]?>&move=up">上移/?weight=<?php echo $rows[weight]?>&move=down">下移


回复讨论(解决方案)

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

看过文档,知道怎么弄了