English 中文(简体)
• 快速建立《世界人权宣言》和《国际法》?
原标题:Fast way to set up CRUD with Code Igniter?

我很想知道,《国际公认法典》是否与我所建立的小框架相当,以及它可能被称作什么。 我建立了一个小型框架,为每个我的ql数据库表设定一个清单观点和编辑观点。 下面是守则的一个实例,说明我如何设立一个中央管理系统,以操纵数据库表:

// CODE FOR LIST VIEW - http://mysite.com/admin/user.php
// This code will output an html table of records from db table t_user.
// The html table will have controls that allow user to search, delete, and paginate
// You can click on each record to edit the record
<?php
include( class/framework.php );
$template = new ListView();
$template->data_object = new DB($mysql_table_name =  t_user );
$template->setCol($col =  user_name , $label =  User Name );
$template->setCol($col =  email , $label =  Email ); 
$template->setCol($col =  last_login , $label =  Last Time Logged In , $format= Y-m-d H:i:s );
$tempate->run();
?>

// CODE FOR EDIT VIEW - http://mysite.com/admin/user.edit.php
// This code will output an html form that adds, edits, deletes
// and validates a record from t_user
<?php
include( class/framework.php );
$template = new EditView();
$template->data_object = new DB($mysql_table_name =  t_user ):

$f = new Field($col =  user_id , $type =  hidden );
$template->field[] = $f;

$f = new Field($col =  email , $type =  text );
$f->arr_validate = array( is_email ,  is_required );
$template->field[] = $f;

$f = new Field($col =  phone , $type =  text );
$f->arr_validate = array( is_phone ,  is_required );
$template->field[] = $f;

$f = new Field($col =  password , $type =  password );
$template->field[] = $f;

$f = new Field($col =  bio , $type =  wysiwyg );
$template->field[] = $f;

$f = new Field($col =  pic , $type =  image );
$template->field[] = $f;


$template->run();
?>

...... 我不必写上一条“html”、 c或 j。 只要Ipope $f->arr_validate,所有鉴定都对我进行。 搜查、分类、gin、ed、删除等能力都是根据上述准则进行的。

《识别法》中是否有类似内容? 如果在盒子中没有这样的东西,那么就是这样说的。

最佳回答

你们所回顾的是所谓的CRUD而不是一个CMS。

C - Create R - Read U - Update D - Delete

为此,我强烈建议。 它非常容易建立。 纳入你重新研究的特征,如想象和搜索等。

问题回答




相关问题
PHP Framework: Ebay Like Site

I am going to be builiding a site like ebay - with all the features of ebay. Please note my payment method is limited to paypal. What would be the best PHP framework to use to build this quickly, ...

What s the proper MVC way to do this....?

Quick question about general MVC design principle in PHP, using CodeIgniter or Kohana (I m actually using Kohana). I m new to MVC and don t want to get this wrong... so I m wondering if i have ...

Check session from a view in CodeIgniter

What is the best way to check session from a view in CodeIgniter, it shows no way in their user guide, otherwise I will have to make two views on everything, which is kinda weird...still a newbie to ...

Using SimplePie with CodeIgniter and XAMPP

I am using CodeIgniter 1.7.2 with XAMPP 1.7.2 on a Windows computer. I am trying to make use of SimplePie. I followed all the instructions I could find: a copy of simplepie.inc is in my applications/...

CodeIgniter adding semicolons

How do I stop CodeIgniter adding semicolons ; to data sent via POST that contains ampersand &? For example it is converting "a=1&b=2&c=3" into "a=1&b;=2&c;=3". From looking on the forums ...

Best way to make Admin pages in CodeIgniter?

I m working on an app in CodeIgniter, and I want to have admin pages for several of the objects in the application, and I m wondering what would be the better way to put these into an MVC structure. ...

CodeIgniter form verification and class

I m using the form validation library and have something like this in the view <p> <label for="NAME">Name <span class="required">*</span></label> <?...

热门标签