*

Recent

Author Topic: Add - Page loading time.  (Read 4197 times)

Frank

  • Sr. Member
  • ****
  • Posts: 257
  • Force: +4/-0
Add - Page loading time.
« on: October 23, 2011, 01:23:23 AM »
Sometimes it's nice to know the time a page takes to load - Especially for Debug purposes. ;)

And I pinched this because I added some mark-up to give the "Unlearned" some idea of how to mark it up.

Top of template.php

Code: [Select]
<?php
    $starttime 
explode(' 'microtime());  
    
$starttime =  $starttime[1] + $starttime[0];  
?>


Bottom of template.php

Change the mark-up to suit your theme.

Code: [Select]
<div style="font-size: 10px; color: #FFFFFF; text-align: center;">

<?php
    $mtime 
explode(' 'microtime());  
    
$totaltime $mtime[0] +  $mtime[1] - $starttime;  
    
printf('Page loaded in %.3f seconds.',  $totaltime); 
?>


</div>

Don't forget also the header.php and footer.php will need to be done too. :P