Where did this variable come from in Codeigniter? And is there more?

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

However, after checking the β€œwelcome”, I see this variable in the footer.

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

From what I understand, the {elapsed_time} variable is an example of using the built-in parser for templates with textual representations instead of using short PHP tags for echo variables.

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

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

And it does not pass $data['elapsed_time']='xxx'; , which means that I can’t understand where the elapsed_time variable comes elapsed_time !

My question is this.

Where is elapsed_time defined? Is it built into the template parser class (and therefore is available for use without its first definition)? If so, where is the list of these other predefined variables? I would like to know what else I have access to, since I knew that elapsed_time available to me, this would be very useful. Does anyone have a list of predefined template parser variables?

Thanks in advance.

+4
source share
2 answers

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

more details here

+13
source

CI will replace the string " {elapsed_time} " in the final output line with the actual "total_execution_time". You can check it in the line system / core / Output.php Line 366 v213

+3
source

All Articles