Welcome Guest, Not a member yet? Register   Sign In
how can i get {elapsed_time} variable in controller
#1

i have used philo/laravel-blade as template engine. i cant find any idea how to show {elapsed_time} in view file that is parsed by philo/laravel-blade ...


some one help me.
Reply
#2

I believe that, even if you use $this->benchmark->elapsed_time(), it's just going to output '{elapsed_time}', because the total execution time isn't available until the Output class makes the substitution.

If you're still going through the Output class, you just need to find a way to escape the output in your template engine to maintain the curly braces in the {elapsed_time} pseudo-variable.

If you're bypassing or overriding the Output->display() method, you would need to use (more or less) the same code which is used in that method to get the information you're looking for. If you do this, though, remember that the {elapsed_time} is not accurate unless the benchmark->elapsed_time() method is called as close as possible to the end of the server's response (right before output actually begins).
Reply
#3

(06-05-2015, 11:59 AM)mwhitney Wrote: I believe that, even if you use $this->benchmark->elapsed_time(), it's just going to output '{elapsed_time}', because the total execution time isn't available until the Output class makes the substitution.

If you're still going through the Output class, you just need to find a way to escape the output in your template engine to maintain the curly braces in the {elapsed_time} pseudo-variable.

If you're bypassing or overriding the Output->display() method, you would need to use (more or less) the same code which is used in that method to get the information you're looking for. If you do this, though, remember that the {elapsed_time} is not accurate unless the benchmark->elapsed_time() method is called as close as possible to the end of the server's response (right before output actually begins).

if i use $this->benchmark->elapsed_time() in template it prints {elapsed_time} that is pseudovariable.




/**
     * Render page 
     *
     * @param  string       $file 
     * @param  array        $arguments 
     * @return null
     */
    public function make($file = false)
    {
if($file) {
echo $this->engine->view()->make($file, ci()->data);
} else {
$controller = ci()->router->fetch_class();
$method = ci()->router->fetch_method(); 
echo $this->engine->view()->make($controller.'.'.$method, ci()->data);
}
    }
Reply
#4

(This post was last modified: 06-06-2015, 11:41 PM by InsiteFX.)

See the CodeIgniter Users Guide:

Benchmarking Class
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB