Reputation: 544
I need a little help. I have this class, that measures page load time
<?php
class Page {
private static $start;
private static $end;
static public function setStartPage(){
return self::$start = microtime(true);
}
static public function setEndPage(){
return self::$end = microtime(true);
}
static public function loadTime(){
return self::$end - self::$start;
}
}
?>
and i call in start of header this:
<?php
Page::setStartPage();
?>
in html body i calling this
<?php echo Page::loadTime();?>
and in the end of page I calling this
<?php
Page::setEndPage();
?>
How do I send values from end page to body in loadTime
function?
Upvotes: 2
Views: 36
Reputation: 42083
If you read book page by page, how can you tell how the story ends in the middle of book?
Instead of:
try:
Most of MVC frameworks out there using layouts do the same. You first prepare content of the page, and just at the end you process a layout, where rendered page is placed into it.
Upvotes: 1