Welcome Guest, Not a member yet? Register   Sign In
grocerycrud
#1

Hello,

I would like to know if this free download grocerycrud has any database ?  I have check the code and wonder if there is any?  The model is empty.  But in the controller it loads the databases.

http://www.grocerycrud.com/image-crud



controllers/images_examples.php

PHP Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class 
Images_examples extends CI_Controller {

    function 
__construct()
    {
        
parent::__construct();
        
        
/* Standard Libraries */
        
$this->load->database();
        
/* ------------------ */
        
        
$this->load->helper('url'); //Just for the examples, this is not required thought for the library
        
        
$this->load->library('image_CRUD');
    }
    
    function 
_example_output($output null)
    {
        
$this->load->view('example.php',$output);    
    }
    
    function 
index()
    {
        
$this->_example_output((object)array('output' => '' 'js_files' => array() , 'css_files' => array()));
    }    
    
    function 
example1()
    {
        
$image_crud = new image_CRUD();
        
        
$image_crud->set_primary_key_field('id');
        
$image_crud->set_url_field('url');
        
$image_crud->set_table('example_1')
            ->
set_image_path('assets/uploads');
            
        
$output $image_crud->render();
        
        
$this->_example_output($output);
    }
    
    function 
example2()
    {
        
$image_crud = new image_CRUD();
        
        
$image_crud->set_primary_key_field('id');
        
$image_crud->set_url_field('url');
        
$image_crud->set_table('example_2')
        ->
set_ordering_field('priority')
        ->
set_image_path('assets/uploads');
            
        
$output $image_crud->render();
    
        
$this->_example_output($output);
    }

    function 
example3()
    {
        
$image_crud = new image_CRUD();
    
        
$image_crud->set_primary_key_field('id');
        
$image_crud->set_url_field('url');
        
$image_crud->set_table('example_3')
        ->
set_relation_field('category_id')
        ->
set_ordering_field('priority')
        ->
set_image_path('assets/uploads');
            
        
$output $image_crud->render();
    
        
$this->_example_output($output);
    }

    function 
example4()
    {
        
$image_crud = new image_CRUD();
    
        
$image_crud->set_primary_key_field('id');
        
$image_crud->set_url_field('url');
        
$image_crud->set_title_field('title');
        
$image_crud->set_table('example_4')
        ->
set_ordering_field('priority')
        ->
set_image_path('assets/uploads');
            
        
$output $image_crud->render();
    
        
$this->_example_output($output);
    }
    
    function 
simple_photo_gallery()
    {
        
$image_crud = new image_CRUD();
        
        
$image_crud->unset_upload();
        
$image_crud->unset_delete();
        
        
$image_crud->set_primary_key_field('id');
        
$image_crud->set_url_field('url');
        
$image_crud->set_table('example_4')
        ->
set_image_path('assets/uploads');
        
        
$output $image_crud->render();
        
        
$this->_example_output($output);        
    }




Please help me understand the program?

Second, can anyone recommend me a good tutorial to create my own library with CI ?  Start with the simple one.

Thanks in advance.
" If I looks more intelligence please increase my reputation."
Reply
#2

(This post was last modified: 05-14-2016, 03:09 PM by twpmarketing.)

(05-14-2016, 04:53 AM)davy_yg Wrote: ...
  But in the controller it loads the databases.
...
/* Standard Libraries */
$this->load->database();
/* ------------------ */
...

This code loads the database LIBRARY, NOT the database itself.
CI 3.1 Kubuntu 19.04 Apache 5.x&nbsp; Mysql 5.x PHP 5.x PHP 7.x
Remember: Obfuscation is a bad thing.
Clarity is desirable over Brevity every time.
Reply
#3

You must create your database, it's not like Post Type on WP
NexoPOS 2.6.2 available on CodeCanyon.
Reply
#4

(This post was last modified: 05-31-2016, 11:41 PM by ciadmin.)

Grocery CRUD is a tool which create a CREAD / READ / UPDATE / DELETE field by using a given table, or some enhancements using the built in callbacks.

To use Grocery CRUD you have to create a controller, and insert something like this in a public function.

$crud = new grocery_CRUD();
$crud->set_table('MYTABLENAME');
$crud->set_subject('MYTABLENAME');
$output = $crud->render();

( note: make sure you've properly made some views etc. )

On how to make your own library, well, it's actually quite well documented in the CI user guide. You can find it at http://www.codeigniter.com/user_guide/ge...aries.html
Reply




Theme © iAndrew 2016 - Forum software by © MyBB