Hello [member='jinbatsu'] and welcome to the forums,
That's a good question actually (It is my fault I didn't documented properly) . You can use the:
$this->load->section($section, $ci_view, $data);
So for example in your case you can have something like:
$data['date_time'] = date('Y-m-d H:i:s');
$this->load->section('datetime_section', 'default_view', $data);
in the view default_view.php you will have:
echo $date_time; //This is your view
and in your layout (e.g. application\views\themes\default.php) you will have this:
//This is your layout
...
$date_time = $this->load->get_section('datetime_section'); //Here you are loading the section at the variable
...
echo $date_time;
...
Hope it is now more clear. Actually if you try it like I've told you it will work like a magic :-)
Just to explain what is happening here is:
$this->load->section($section, $ci_view, $data);
The $section is any string you like for example 'my_section' , the $ci_view and the $data is the view name and the data (optional). Is like using the $this->load->view($ci_view, $data); with the only difference that this particular view will be loaded as a section. To actually call this section you just need to call it through your layout like this: $this->load->section($section_name); and that's it.
Please let me know if this worked for you.
Regards
Johnny