Posted By

nielsenrc on 11/30/11


Tagged

codeigniter


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Kurt


Simple CodeIgniter Templating


 / Published in: PHP
 

Basically, a simple way to use a templating system in CodeIgniter. In your data array, add a view as the value for content. Pass that to the view, then print the $content variable in the view.

  1. //In the controller:
  2.  
  3. public function index() {
  4. $this->data['content'] = 'your-views-name';
  5. $this->load->view('your-templates-name', $this->data);
  6. }
  7.  
  8. //In the view:
  9.  
  10. <?php $this->load->view($content); ?>

Report this snippet  

You need to login to post a comment.