Welcome Guest, Not a member yet? Register   Sign In
Loading Views: Efficiency question

Before CodeIgniter I used to load embedded views using standard php inside the current view like:
<?php include ("header.php"); ?>

I really like the way CI handles loading multiple views from the controller and I want to change my old sites to match this technique.
Could this change slow (or speed up Smile ) the rendering of the pages?

Technically it will slow you down
Because to load in CI requires you to call a seperate function i.e. $this->load->view
Each function call you make takes a toll on the performance
Also to make sure that data is available in the view it must be extracted before the view file is included.

however on the plus side once you start to use CI you can take advantage of its cache which can improve performance

[eluser]Derek Allard[/eluser]
Yeah, and while tonanbarbarian is absolutely correct that it is technically slower, it'll still be freaky-fast, and I doubt you'd ever notice a performance hit.

And the biggest advantage is the ability to pass 'data' to that view eg.

$data['title'] = 'Best page';

And the $data['title'] is auto-magically accessed as $title in the view Smile

Theme © iAndrew 2016 - Forum software by © MyBB