[eluser]tieungao[/eluser]
[quote author="web-johnny" date="1303121255"][quote author="tieungao" date="1303114833"]Let's say we have one example below :
function offices()
{
$user = $this->ion_auth->get_user()->username;
$this->grocery_crud->render();
}
How i can display var $user at your custom_cms template?
Thanks[/quote]
You can simply do
Code:
function offices()
{
$user = $this->ion_auth->get_user()->username;
$this->load->view('login_as',array('username' => $user));
$this->grocery_crud->render();
}
Or whatever view you like (before crud or after). And it will load in the $output as I say to the documentation. Its pretty simple.
I have also sections on the template. But I still don't want to make it more complicated for you. If though you really need to do it with sections , for example : section user , section menu , section footer etc. Just ask it for.
Hope this helps[/quote]
Thanks so much for your fast support!
In fact i already have a project with header, footer and templates.
Now i want to embed your CRUD to this.
I've tried to do like that :
in controllers/admin.php :
Code:
function __construct()
{
parent::__construct();
$this->load->library('ion_auth');
$this->load->helper(array('form','url'));
$this->load->library('session');
$this->load->library('form_validation');
if (!$this->ion_auth->logged_in()) redirect("auth/login");
$this->load->database();
$this->db->query('SET names utf8');
$this->load->add_package_path(APPPATH.'third_party/grocery_crud/');
$this->load->library('grocery_CRUD');
$this->output->set_template('custom_cms');
if (!$this->ion_auth->is_admin()) redirect(base_url());
}
function ketqua()
{
$crud = new grocery_CRUD();
$crud->set_table('kqmn');
$this->load->view('includes/header',$this->data);
$this->load->view('admin/home',$this->data);
$this->load->view('includes/footer',$this->data);
$crud->render();
}