render
object render()
Quick Description: Or else ... make it work!! The web application takes decision of what to do and show it to the user.
Or else ... make it work!! The web application takes decision of what to do and show it to the user. This is the most important method in grocery CRUD. Without this method nothing happens.
So for example if we have:
$crud = new grocery_CRUD(); $crud->set_table('customers') ->set_subject('Customer') ->columns('customerName','contactLastName','phone','city','country','creditLimit') ->display_as('customerName','Name') ->display_as('contactLastName','Last Name'); $crud->fields('customerName','contactLastName','phone','city','country','creditLimit'); $crud->required_fields('customerName','contactLastName');
With the above code we just set the properties/features that our CRUD will have. And with the method render:
$output = $crud->render();
everything will work. You don't need to add anything else to make it work, just the render.
You can see a full example of using the render method below:
function full_example() { $crud = new grocery_CRUD(); $crud->set_table('customers') ->set_subject('Customer') ->columns('customerName','contactLastName','phone','city','country','creditLimit') ->display_as('customerName','Name') ->display_as('contactLastName','Last Name'); $crud->fields('customerName','contactLastName','phone','city','country','creditLimit'); $crud->required_fields('customerName','contactLastName'); $output = $crud->render(); $this->_example_output($output); }
Note: The below example is an iframe so it might appeared with a scroll bar. If you like you can view the example
on a new tab