I'm trying to move from AngularJS to PHP Model-View-Controler framework and something doesn't stick to me, because I do to much repeating. In angular you can do simple include of footer and header and all magic happens in view depending od the route. But in Codeiginiter for every view you need to include header and footer. Is there any good practice in which you don't have to do the much repeating
In angularjs i have simple.
<div ng-include='"templates/header.html"'></div>
<div ng-view></div>
<div ng-include='"templates/footer.html"'></div>
And this is routing
.when("/", {
templateUrl: "partials/home.html",
controller: "PageCtrl"
})
// Pages
.when("/home", {
templateUrl: "partials/home.html",
controller: "PageCtrl",
})
.when("/about", {
templateUrl: "partials/about.html",
controller: "PageCtrl"
})
And this is how is done in CodeIgniter
public function home(){
$this->load->view('templates/header');
$this->load->view('about');
$this->load->view('templates/footer');
}
public function about(){
$this->load->view('templates/header');
$this->load->view('index');
$this->load->view('templates/footer');
}