// Load a template file and return it's content (only it's name; do not use ' or ")
function LOAD_TEMPLATE($template, $return=false, $content="") {
// Add more variables which you want to use in your template files
- global $DATA, $username;
+ global $DATA, $CONFIG, $username;
+
+ // Count the template load
+ if (!isset($CONFIG['num_templates'])) $CONFIG['num_templates'] = 0;
+ $CONFIG['num_templates']++;
+
+ // Init some data
$ACTION = SQL_ESCAPE($GLOBALS['action']);
$WHAT = SQL_ESCAPE($GLOBALS['what']);
$ret = "";
// Exit explicitly
exit;
}
+
+// Display parsing time and number of SQL queries in footer
+function DISPLAY_PARSING_TIME_FOOTER() {
+ global $startTime, $CONFIG;
+ $endTime = microtime(true);
+
+ // Is the timer started?
+ if (!isset($GLOBALS['startTime'])) {
+ // Abort here
+ return false;
+ }
+
+ // "Explode" both times
+ $start = explode(" ", $GLOBALS['startTime']);
+ $end = explode(" ", $endTime);
+ $runTime = $end[0] - $start[0];
+ if ($runTime < 0) $runTime = 0;
+ $runTime = TRANSLATE_COMMA($runTime);
+
+ // Prepare output
+ $content = array(
+ 'runtime' => $runTime,
+ 'numSQLs' => ($CONFIG['sql_count'] + 1),
+ 'numTemplates' => ($CONFIG['num_templates'] + 1)
+ );
+
+ // Load the template
+ LOAD_TEMPLATE("footer_stats", false, $content);
+}
+
//
//////////////////////////////////////////////
// //