Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where does this variable come from in Codeigniter? And are there any more?

In the default Codeigniter installation there is the "welcome" controller which has a "index" action which loads the "welcome" view. This works as expected.

However, upon inspecting the "welcome" view I can see this variable in the footer.

<p class="footer">Page rendered in <strong>{elapsed_time}</strong> seconds</p>

From what I understand the variable {elapsed_time} is an example of using the built in template parser with text representations instead of using PHP short tags to echo variables.

But inside the "welcome" controller the only lines in the "index" action are these.

$this->load->view('welcome');

And it doesn't pass $data['elapsed_time']='xxx'; which means that I can't figure out where the variable elapsed_time is coming from!

My question is this.

Where does elapsed_time get defined? Is it built into the template parser class (and therefore available to be used without first defining it)? If so, where is a list of these other pre-defined varaibles? I would like to know what else I have access to as had I known that elapsed_time was available to me it would have been very useful. Does anyone have a list of the template parser pre-defined variables?

Thanks in advance.

like image 268
GhostInTheSecureShell Avatar asked Dec 04 '22 14:12

GhostInTheSecureShell


1 Answers

elapsed_time defined output class. this class is initialized automatically by CodeIgniter.

more info here

like image 82
ILker Özcan Avatar answered May 10 '23 14:05

ILker Özcan