Page timer & MySQL counter

Date 2004/11/17 19:32:44 | Topic: Hacks

Got a little distracted this week and as a little side project I have created a smarty insert plugin that displays the page execution time, and MySQL queries generated to render each page. The advantage of using the insert method is that the insert function code is always executed each time it is invoked, and isn't cached in the template along with all the other output data. This meaning that the page timer and MySQL counter figures are always going to be current and relevant to the page being displayed, regardless of if block and/or module cache is active.
You can see a demostration of this code at the base each page at IT Headquarters. I would like to send a big thank you to Mith and Dave_L who got me over the line on this one .

Download It Here!

Best yet is that no system files need to be modified, and you can have this plugin up and running in just a few minutes. Installation instructions are below;



1) upload insert.showstat.php file to your /class/smarty/plugins directory from your Xoops root folder.

2) Go into your Xoops control panel, and goto System Admin->Preferences Main->General Settings and set the "Update module template .html files from themes/your theme/templates directory?" to yes.

3) Insert the "<{insert name='showstat'}>" minus the "" into your theme.html file and view your homepage (you should see something like "0.432 Seconds | 46 Queries" printed at the base of your page).

4) Go into your Xoops control panel, and goto System Admin->Preferences Main->General Settings and set the "Update module template .html files from themes/your theme/templates directory?" to no.

5) Set all your block and caching options to suit your site, and this smarty plugin should now display the execution time and MySQL query count generated for producing every page.




This article comes from XOOPS Web Application System
https://xoops.org

The URL for this story is:
https://xoops.org/modules/news/article.php?storyid=1862