Hi,
I’m using multiple view files for various elements of the rendered page, such as the header, footer, and other widgets.
CodeIgniter docs suggest I should be loading these views entirely from the controller like so:
<?php
class User extends Controller {
public function register(){
$this->load->view('header');
$this->load->view('user/register');
$this->load->view('footer');
}
};
?>
I have just recently begun loading the ‘header’ and ‘footer’ views from within the ‘user/register’ view itself using:
<?php $this->load->view('header');?>
Yak yak yak
<?php $this->load->view('footer');?>
This way I only have to load the ‘user/register’ view from the controller, but is it good practice? Are all the benifits of using views ( as opposed to just echoing data ) still intact?