Wednesday, August 10, 2011

How to Make CRUD Fast Using Grocery CRUD




Oke this time I'will create tutorial how to use Geocery CRUD..
this, plugin Code Igneter for CRUD with AJAX .. NICE


    * You can see some file and directory
    * Please COPY file with appropriate your CI project
        * example in  directory application/config you copy file in same directory in CI

application/config...
         * same step in another file
    * For directory public and templates you just copy in early directory project CI



third, create controller in directory CI application/controller, example shoutbox.php



okey please rewrite file with :
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class ShoutBox extends CI_Controller {

function __construct()
{
parent::__construct();
/* Standard Libraries */
$this->load->database();
$this->load->helper('url');
/* ------------------ */ 

$this->load->add_package_path(APPPATH.'third_party/grocery_crud/');

$this->output->set_template('custom_cms'); 

$this->load->library('grocery_CRUD');
}

function index(){

}

function offices()
{
$this->grocery_crud->render();
}

function shoutbox_management()
{
$this->load->library('grocery_Exceptions');
try{
/* This is only for the autocompletion */
$crud = new grocery_CRUD();

//$crud->set_theme('datatables');
$crud->set_table('shoutbox');
$crud->set_subject('ShoutBox');
$crud->required_fields('kata_ind');
$crud->columns('kata_ind','kata_en');

$crud->render();

}catch(Exception $e){
$this->grocery_exceptions->show_error($e->getMessage(), $e->getTraceAsString());
}
}
}


After this you create database with table shoutbox and with column id,kata_ind,kata_en. And Please CONFIGURE YOUR CI PROJECT with Your Database...


fourth, open file template.php in directory templates/custom_cms/
edit tag php on line 32

site_url('shoutbox/shoutbox_management')

change with
site_url('shoutbox/shoutbox_management')
That's Code for url CRUD

Now, Please Open address :http://localhost/yourproject/index.php/shoutbox/
"

1 comment:

Comments