Installation for Codeigniter

Also available in Russian and French

The installation is really easy. You just copy all the files to your project and you are ready to use grocery CRUD.

By the end of the installation, your file structure should look similar to this (the below structure is the default unchanged folders/files of codeigniter):

website_folder/
–––– application/
–––––––– config/
–––––––––––– autoload.php
–––––––––––– ...
–––––––––––– doctypes.php
–––––––––––– foreign_chars.php
–––––––––––– grocery_crud.php
–––––––––––– ...
–––––––– controllers/
–––––––––––– examples.php
–––––––––––– index.html
–––––––––––– welcome.php
–––––––– libraries/
–––––––––––– grocery_crud.php
–––––––––––– index.html
–––––––– models/
–––––––––––– grocery_crud_model.php
–––––––––––– index.html
–––––––– views/
–––––––––––– example.php
–––––––––––– index.html
–––––––––––– welcome_message.php
–––– assets/
–––––––– grocery_crud/
–––––––––––– css/
–––––––––––– js/
–––––––––––– texteditor/
–––––––––––– themes/
–––––––– uploads/
–––––––– index.html
–––– system/
–––– user_guide/
–––– change_log.txt
–––– example_database.sql
–––– index.php
–––– licence-grocery-crud.txt
–––– license.txt

Below I have an example of how a controller will look like.

 if ( ! defined('BASEPATH')) exit('No direct script access allowed');

 
class Examples extends CI_Controller {
 
    function __construct()
    {
        parent::__construct();

 
        /* Standard Libraries */
        $this->load->database();
        $this->load->helper('url');

        /* ------------------ */    
 
        $this->load->library('grocery_CRUD');    
    }
 
    function _example_output($output = null)

    {
        $this->load->view('example.php',$output);    
    }
 
    function offices()

    {
        $output = $this->grocery_crud->render();
 
        $this->_example_output($output);

    }
 
.......
}

The only required libraries are to connect with the database (that we usually have it as auto-load library) and the url helper.

The variable $output is an object that always includes the following properties - output, js_files, css_files. Below you see an example of a print_r of a variable $output

stdClass Object
(
[output] => Your output will appear here....
[js_files] => Array
(
[763b4d272e158bdb8ed5a12a1824c94f494954bd] => http://grocery_crud/public/grocery_crud/themes/datatables/js/jquery-1.6.2.min.js
[0b677f3fc6fb25b4baf39eb144222116c5b60254] => http://grocery_crud/public/grocery_crud/themes/flexigrid/js/cookies.js
[ec3ae62b8d5838972e858fe54447bd4bd8d79f88] => http://grocery_crud/public/grocery_crud/themes/flexigrid/js/flexigrid.js
[2c0ff56d0cbc6f80a5ef9c770d478f0e00c3170d] => http://grocery_crud/public/grocery_crud/themes/flexigrid/js/jquery.form.js
[474495ff1e895eab81fb8afba4db9b06c15b19af] => http://grocery_crud/public/grocery_crud/themes/flexigrid/js/jquery.numeric.js
)

[css_files] => Array
(
[732b03aa54d124f062757b71e5560acdc5632ba6] => http://grocery_crud/public/grocery_crud/themes/flexigrid/css/flexigrid.css
)

)

The view example.php that its a simple Codeigniter view and includes the below code:

 
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
 
<?php 
foreach($css_files as $file): ?>
    <link type="text/css" rel="stylesheet" href="<?php echo $file; ?>" />
 
<?php endforeach; ?>
<?php foreach($js_files as $file): ?>
 
    <script src="<?php echo $file; ?>"></script>
<?php endforeach; ?>
 
<style type='text/css'>
body
{
    font-family: Arial;
    font-size: 14px;
}
a {
    color: blue;
    text-decoration: none;
    font-size: 14px;
}
a:hover
{
    text-decoration: underline;
}
</style>
</head>
<body>
<!-- Beginning header -->
    <div>
        <a href='<?php echo site_url('examples/offices_management')?>'>Offices</a> | 
        <a href='<?php echo site_url('examples/employees_management')?>'>Employees</a> |
        <a href='<?php echo site_url('examples/customers_management')?>'>Customers</a> |
        <a href='<?php echo site_url('examples/orders_management')?>'>Orders</a> |
        <a href='<?php echo site_url('examples/products_management')?>'>Products</a> | 
        <a href='<?php echo site_url('examples/film_management')?>'>Films</a>
 
    </div>
<!-- End of header-->
    <div style='height:20px;'></div>  
    <div>
        <?php echo $output; ?>
 
    </div>
<!-- Beginning footer -->
<div>Footer</div>
<!-- End of Footer -->
</body>
</html>
 

That's it! You can now celebrate that you can use the power of grocery CRUD in your project. Continue with the examples or go straight to the methods/functions of grocery CRUD library

Doesn't work?. You can also see the newbies grocery CRUD installation guide

In addition, you can check the known issues or you can find the answer at grocery CRUD forum. Still you can't install it? Send us a message at support form and we will answer you as soon as possible.

Latest download
grocery CRUD Newsletter
Join our newsletter to receive our last updates and news.
* indicates required