Source for file function.pagerendertime.php
Documentation is available at function.pagerendertime.php
* Zikula Application Framework
* @copyright (c) 2004, Zikula Development Team
* @link http://www.zikula.org
* @version $Id: function.pagerendertime.php 24342 2008-06-06 12:03:14Z markwest $
* @license GNU/GPL - http://www.gnu.org/copyleft/gpl.html
* @package Zikula_Template_Plugins
* Smarty function to get the site's page render time
* - assign if set, the message will be assigned to this variable
* - round if the, the time will be rounded to this number of decimal places
* <!--[pagerendertime]--> outputs 'Page created in 0.18122792243958 seconds.'
* <!--[pagerendertime round=2]--> outputs 'Page created in 0.18 seconds.'
* @param array $params All attributes passed to this function from the template
* @param object $smarty Reference to the Smarty object
* @param string $round format to apply to the number (based on the round php function)
* @return string the page render time in seconds
if ($GLOBALS['PNConfig']['Debug']['pagerendertime']){
// calcultate time to render
$dbg_endtime = $mtime[1] + $mtime[0];
$dbg_totaltime = ($dbg_endtime - $GLOBALS['PNRuntime']['dbg_starttime']);
if ($GLOBALS['PNConfig']['Debug']['debug']){
$GLOBALS['PNRuntime']['dbg']->v($dbg_totaltime,"Page created in (seconds)");
$round = isset ($params['round']) ? $params['round'] : 2;
$dbg_totaltime = round($dbg_totaltime, $round);
if (isset ($params['assign'])) {
$smarty->assign('rendertime', $dbg_totaltime);
$message = '<div class="pn-sub" style="text-align:center;">' . pnML('_THEME_PAGECREATEDINSECONDS', array('sec' => $dbg_totaltime)) . '</div>';
|