本人龟鉴其他PHP Framework 自己开发的一个Framework,请大家指点
本人借鉴其他PHP Framework如autocrud等,还有ror的思想.?自己开发的一个Framework
?
系统根据建好的数据库自动生成model、controller和view的各个文件:
?
本人是初学者,请大家多多指点
?
Model:
?
include "connect.php";
class users extends Connect{??
?function Add($data){
??$this->crud->users->insert($data);
?}
?function Select($orderby,$where,$currentpage,$paging){
??$this->crud->users->orderby = "$orderby";
??$this->crud->users->where = "$where";
??$paging==1 ? $this->crud->users->paging = true : $this->crud->users->paging = false;
??$this->crud->users->perpage = 2;
??$this->crud->users->currentpage = $currentpage;
??return $this->crud->users->select();
?}
?function Get($id){
??return $this->crud->users->get($id);
?}
?function Delete($id){
??return $this->crud->users->delete($id);
?}
?function Update($data,$id){
??return $this->crud->users->update($data, $id);
?}
}
?>
?
?
controller:
?
include ('models/users.php');
include ('smarty/template.php');
$tpl = new SmartTemplate("views/listusers.htm");
$users = new users;
$orderby = "";
$where = "";
$currentpage = $_GET['page'];
$userss = $users->Select($orderby,$where,$currentpage,0);
$rows = count($userss);
$userss = $users->Select($orderby,$where,$currentpage,1);
$i = 0;
if($rows > 0){
??? for($j = 0; $j ???? $i = 1-$i;
???? ($i==0) ? $bgcolor="#eff1f3" : $bgcolor="#feefd5";
???? $userss[$j][bgcolor] = $bgcolor;
?}
}
$tpl->assign(array(
"userss"=>$userss,
"rows"=>$rows));
$tpl->output();
?>
?
view:
?
没有您要查找的记录! 新增..
id
name
操作
{id}
{name}
删除 编辑 查看
?
?
相关文章
相关视频
上一篇: HoverTree开发日志之验证码
下一篇: 互联网时代真的人人都是产品经理?