[eluser]a/\ekc[/eluser]
Quote:if something like this appears
Code:
Fatal error: Cannot access protected property
MY_Output::$final_output
which happens in this line:
Code:
$this->output->final_output = '';
so just make the variable public in the CI_Output Class.
It's no good way to change the core files I think.
I can forget in the future, that something was changed in core files. And after update of the core files the same error will be.
I voted for default template, but would like to see it more
flexible.
In grocery_crud.php file functions have such code parts
Code:
$ci->load->js('public/grocery_crud/js/jquery_plugins/.../somefile.js');
$ci->load->css('public/grocery_crud/css/..../somefile.css'); ');
And this make me always have "public" folder in top of web directory
To change template folder i have to go in application/core/MY_Output and change
Code:
const TEMPLATE_ROOT = "templates/";
It's no flexible
My way.
I had a project with cms template (application/views/cms/template.php)
Code:
<?php
//template without CRUD
$this->load->view('cms/header');
if (isset($content)) echo $content;
$this->load->view('cms/footer');
?>
And want to use grocery crud. So almost the same template was created in "templates/cms/template.php".
Code:
<?php
//template for CRUD
$this->load->view('application/views/cms/header');
if (isset($content)) echo $content;
echo $output;
$this->load->view('application/views/cms/footer');
?>
Both template.php have the same header. So in header.php this code was placed:
Code:
<?php
<head>
....
if (isset($crud)) { //check using CRUD
foreach($css as $file): ?>
<link type="text/css" rel="stylesheet" href="<?php echo $file; ?>" />
<?php endforeach; ?>
[removed]var base_url = '<?=base_url()?>';[removed]
<?php foreach($js as $file): ?>
[removed][removed]
<?php endforeach;
}
...
</head>
?>
In cms controller
Code:
public function my_table() {
//use crud template
$this->load->add_package_path(APPPATH.'third_party/grocery_crud/');
$this->output->set_template('cms');
$this->load->library('grocery_CRUD');
$crud = new grocery_CRUD();
$crud->set_theme('datatables');
$crud->set_table('my_table');
$this->output->set_output_data('crud','yes'); //for header.php
$this->output->set_output_data('content','some additional content before crud table');
$crud->render();
}
All works fine but small inconvenience to have two templates