Return to Snippet

Revision: 53641
at November 30, 2011 10:47 by nielsenrc


Updated Code
//In the controller: 

public function index() {
                 $this->data['content'] = 'your-views-name'; 
                 $this->load->view('your-templates-name', $this->data);
        }

//In the view:

<?php $this->load->view($content); ?>

Revision: 53640
at November 30, 2011 10:07 by nielsenrc


Initial Code
//In the controller: 

public function index() {
                 $this->data['content'] = 'your-views-name'; 
                 $this->load->view('your-templates-name', $this->data);
        }

//In the view:

<?php $this->view($content); ?>

Initial URL

                                

Initial Description
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.

Initial Title
Simple CodeIgniter Templating

Initial Tags
codeigniter

Initial Language
PHP