I have several controllers that load the same views (besides specific views for each controller). Is there a way to do it only once ?
Create a template_view, something like this add more if you need them.
<?php $this->load->view(header_view);?><?php $this->load->view(body_view);?><?php $this->load->view(footer_view);?>
Controller:
$this->load->vars($data);$this->load->view('template_view');
InsiteFX
Ceritfied State of CT Computer Programming Teacher. Custom Designed Icons, eBook Covers Software Boxes. CD, DVD Etc. New iPhone® Tab Bar Icons and iPhone® Applications Icons.
STOP! Before posting your questions, remember the WWW Golden rule: What did you try? What did you get? What did you expect to get? Input -> Controller | Processing -> Model | Output -> View
STOP! Before posting your questions, remember the WWW Golden rule: What did you try? What did you get? What did you expect to get?
Input -> Controller | Processing -> Model | Output -> View
thanks but what I meant was regarding the $data…
you mean this?
<?php $data[‘body’]=“view body content”; $this->load->view(‘body_view’,$data); ?>
Pinoy/PHP Developer/Codeigniter
My Blog
You mentioned nothing about data all about views! Then look into creating a MY_Controller in the CodeIgniter User Guide
This can be used any place in your code and makes the data avaiable to all your views!
$this->load->vars($data);