I draw from other PHP framework to develop their own framework, please point out
I learn from other PHP framework such as Autocrud, and ror ideas. A framework developed by oneself
?
The system automatically generates individual files of model, controller, and view according to the built-in database:
?
I am a beginner, please give us a lot of advice
?
Model:
?
Include "connect.php";
Class users extends connect{??
? function Add ($data) {
?? $this->crud->users->insert ($data);
?}
function Select (erby, $where, $currentpage, $paging) {
?? $this->crud->users->orderby = "erby";
?? $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;
erby = "";
$where = "";
$currentpage = $_get[' page '];
$userss = $users->select (erby, $where, $currentpage, 0);
$rows = count ($userss);
$userss = $users->select (erby, $where, $currentpage, 1);
$i = 0;
if ($rows > 0) {
??? for ($j = 0; $j < count ($userss); $j + +) {
???? $i = 1-$i;
???? ($i ==0)? $bgcolor = "#eff1f3": $bgcolor = "#feefd5";
???? $userss [$j][bgcolor] = $bgcolor;
?}
}
$TPL->assign (Array (
"Userss" = $userss,
"Rows" = $rows));
$tpl->output ();
?>
?
View
?
There is no record you are looking for! New..
Id |
Name |
Operation |
{ID} |
{Name} |
Delete the edit view |
?
?