I personally know a self-developed PHP Framework from other phpframeworks. please give me some advice.

Source: Internet
Author: User
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



?

?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.