Please login or register.

Login with username, password and session length
Advanced search  


You need/want an older version of sNews ? Download an older/unsupported version here.

Author Topic: [Mini-MOD] page generation time in footer  (Read 1583 times)


  • Sr. Member
  • ****
  • Karma: 23
  • Posts: 381
  • Passion for quality and excellence!
    • My personal blog and portofolio
[Mini-MOD] page generation time in footer
« on: January 22, 2008, 07:39:54 pm »

Hi again  :-\,

As you know already, i use plenty MODs and ADDONs from this forum but sometimes i need new features that i need to write them myself, or to get from an existing MOD and modify it to my needs. Some of them have good look effects to the site, others are bringing good functionalities.

The current will measure the page generation time. Useful for site builders for testing, improoving page generation time and also for the online sites. I took the timer code from here (with postme's permission, Thank you postme!) and i have written some steps to show you how can you use this piece of code for testing purpose or for normal use.

Step 1. Create a directory called mods. If already exists, then it is okay.
Step 2. In the mods directory create another directory, called timer.
Step 3. New php file creation:

Code: [Select]

explode' 'microtime() );
$stimer $stimer[1] + $stimer[0];


Save it as start.php and save it into the timer directory.

You will have:


Step 4. Another file must be created:

Code: [Select]

explode' 'microtime() );
$etimer $etimer[1] + $etimer[0];
'<p align="center">';
printf(l('page_timer').": <b>%f</b> ".l('seconds'), ($etimer-$stimer) );


Save this file as end.php in the timer directory.

You will have:


Step 5. Add 2 new language variables to the language variables list:

Code: [Select]
$l['page_timer'] = 'Page generation time';
$l['seconds'] = 'seconds';

Step 6. In the root directory into the index.php file add blue line:


NOTE: I have added already the "Template Switcher" MOD from bakercad!

Step 7. In the template file, before the </body> tag you can add the following code:

Code: [Select]
<div class="timer">
<?php include_once('mods/timer/end.php'); ?>

Step 8. Class for the step 7:

Code: [Select]
.timer {
background : #ffffff;
margin : 0px auto 0px auto;
width : 950px;
clear : both;
height : 15px;
font : normal 11px Verdana;
color : #808080;

NOTE: Of course this you will customise regarding your needs :)

This is it, thanks for reading my new post, no comments are required, i know that my first mods are not too important, but as i said already, i need them, i use them and i was thought to share them here on the forum, a place what i like very much for it's community :D

By(e) Henrich :)
IT related blog