I want to learn from a Framework developed by other phpframeworks. could you please tell me how to learn from other phpframeworks such as autocrud and the idea of ror .? A self-developed Framework? The system automatically generates a model and contr based on the created database, and draws on a Framework developed by other PHP frameworks.
I have learned from other PHP frameworks such as autocrud and the idea of ror .? A self-developed Framework
?
The system automatically generates model, controller, and view files based on the created database:
?
I am a beginner. please give me more advice.
?
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 <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:
?
No record for your search! New ..
Id |
Name |
Operation |
{Id} |
{Name} |
Delete & nbsp edit & nbsp view |
?
?