1
PnViking
How To: Page generated in 0.4534 seconds?
  • 2004/3/21 9:49

  • PnViking

  • Just popping in

  • Posts: 9

  • Since: 2004/1/31


Hi,

I like this cool function that displays the time it takes to generate the page. But how do i do that?

Regards,

Nick

2
T-Tech
Re: How To: Page generated in 0.4534 seconds?
  • 2004/3/21 11:01

  • T-Tech

  • Just popping in

  • Posts: 62

  • Since: 2004/3/3 1


I do believe you could do that with a function similar to this one...

function footmsg() {
    global 
$copyright$total_time$start_time;
    
$mtime microtime();
    
$mtime explode(" ",$mtime);
    
$mtime $mtime[1] + $mtime[0];
    
$end_time $mtime;
    
$total_time = ($end_time $start_time);
    
$total_time 'Page Generated In ".substr($total_time,0,5)." Seconds';
    echo 
"<center>";
    echo 
"$copyright<br>$total_time<br>n</center>n";
}
$xoopsTpl->assign("show_total_time"$total_time);



3
PnViking
Re: How To: Page generated in 0.4534 seconds?
  • 2004/3/21 17:44

  • PnViking

  • Just popping in

  • Posts: 9

  • Since: 2004/1/31


Hi,

thanks for the code, i ended up adding this line to footer.php:

$xoopsTpl->assign("show_total_time"substr($xoopsLogger->dumpTime(), 06));

and this to theme.html:

Done in <{$show_total_time}> seconds

Thanks,

Nick

4
Stewdio
Re: How To: Page generated in 0.4534 seconds?
  • 2004/3/21 18:10

  • Stewdio

  • Community Support Member

  • Posts: 1560

  • Since: 2003/5/7 1


Thanks for the snip Nick. Took me a few tries to figure out where in the footer it should go, but I got it working after a bit of trial and error.

Cheers

5
PnViking
Re: How To: Page generated in 0.4534 seconds?
  • 2004/3/21 18:48

  • PnViking

  • Just popping in

  • Posts: 9

  • Since: 2004/1/31


Sorry about that...

I added it before line 61 in footer.php:
if (!headers_sent()) {

And as they said in an eirlier thread, the caching has to be turned off in general settings, for it to work.

Nick

6
Stewdio
Re: How To: Page generated in 0.4534 seconds?
  • 2004/3/21 18:53

  • Stewdio

  • Community Support Member

  • Posts: 1560

  • Since: 2003/5/7 1


Heh, I added mine on line 30 thusly:

line 29:define("XOOPS_FOOTER_INCLUDED",1);
line 30: $xoopsTpl->assign("show_total_time", substr($xoopsLogger->dumpTime(), 0, 6));
Line 31: $xoopsLogger->stopTime();

7
Mithrandir
Re: How To: Page generated in 0.4534 seconds?

I guess that for it to be the most precise it will have to go right before the $xoopsTpl->display() call in order not to get a premature time.

8
hughs
Re: How To: Page generated in 0.4534 seconds?
  • 2004/3/22 8:17

  • hughs

  • Not too shy to talk

  • Posts: 117

  • Since: 2003/10/7


Hi.
In my Homepage i have a javascript for that, now i like to
ask you, which one do you recommend ?, which one is more
accurate ?.
thanks
hughs

Login

Who's Online

189 user(s) are online (142 user(s) are browsing Support Forums)


Members: 0


Guests: 189


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits