no this will not work.
You have to forget for a bit how the js, css and views will load. Everything will be automatically without even do anything more.
I will explain what you have to do to make it work.
1. First of all make sure that you copy all the files and folders of grocery CRUD to your project.
2. The example.php it is actually included at the files and folder of grocery CRUD and you don't have to do anything else
3. now the only thing that you have to do is to go to your basic controller (let's say Main) and add your code there:
public function affiliates()
{
$crud = new grocery_CRUD();
$crud->set_table('accounts')
->set_subject('Accounts')
->columns('username','password','email','paypal_bank','lastname','address')
->display_as('paypal_bank','Paypal')
->display_as('lastname','Last Name');
$crud->fields('username','password','email','paypal_bank','lastname','address');
$crud->required_fields('username','password');
$output = $crud->render();
$this->_example_output($output);
}
function _example_output($output = null)
{
$this->load->view('example.php',$output);
}
If you copy this code above and then go to /your_project/index.php/main/affiliates you can see that believe it or not your CRUD is ready. Test the edit and add (just add something to test it) and then go to step 4
4. Now that your default functionallity of grocery CRUD works I can explain you how it works. Your actually output is this:
$output->output; //Your output
$output->js_files; //Your js files
$output->css_files; //Your css files
So now you can simply add your custom view. for example:
....
$output = $crud->render();
$this->load->view('header.php',$output);
$this->load->view('my_view.php',$output);
$this->load->view('footer.php');
Then in your view you can easily take the data with simple variables like this ( header.php ):
<?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; ?>
and the output easily with ( my_view.php ) :
<?php
echo $output; // Your datagrid, your add form your edit ... e.t.c. will be here automatically so don't worry about them
?>
You don't need anything more. As I understood you are new to Codeigniter so firstly you have to understand that for example if you have any array or object (in our case is an object) the array/object transforms into variables for the view. For example if you have:
$output = (object)array('test1' => 'Test 1', 'test2' => 'Test 2');
$this->load->view('test.php',$output);
in the view you have to call the variables like this:
<?php
echo $test1; // Test 1
echo $test2; // Test 1
?>
If this still didn't work for you try to:
1. download the Codeigniter again from the beginning and open a new project
2. Copy all the files and folder of grocery CRUD as I told you
3. Go to phpmyadmin and create a new database let's name it "test_database"
4. Import the example database at: examples_database.sql
5. Configure your database file from application/database.php
6. And now go to open your_project/index.php/examples and click to the links to see grocery CRUD in action. This is a good start because at least you will have a working example and you can play with this example. (All the examples are at the controller examples.php )
I hope it helps. If you are still have problems don't hesitate to send a post. That's why this forums is all about