Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: Adding page generate time at the bottom?  (Read 3816 times)

0 Members and 1 Guest are viewing this topic.

eagleknight

  • Coppermine newbie
  • Offline Offline
  • Posts: 6
Adding page generate time at the bottom?
« on: March 14, 2005, 02:57:24 pm »

Did a search, but couldn't find how to do this. It is probally pretty simple, but where and what do I add to get the page generate time at the bottom of each page. I know it is given in debug mode, but would like it to be able to show to anyone visisted.  ???
« Last Edit: March 16, 2005, 05:53:24 am by TranzNDance »
Logged

Nibbler

  • Guest
Re: Adding page generate time at the bottom?
« Reply #1 on: March 14, 2005, 03:11:24 pm »

Same way as any other pagefooter (- see the docs). You can get the time by doing:

Code: [Select]
$time_end = cpgGetMicroTime();
$time = round($time_end - $time_start, 3);
Logged

eagleknight

  • Coppermine newbie
  • Offline Offline
  • Posts: 6
Re: Adding page generate time at the bottom?
« Reply #2 on: March 14, 2005, 03:23:20 pm »

Thx for fast reply. I'll try that.  ;)
Logged

eagleknight

  • Coppermine newbie
  • Offline Offline
  • Posts: 6
Re: Adding page generate time at the bottom?
« Reply #3 on: March 14, 2005, 03:41:35 pm »

I need to add it in the theme.php from reading the docs, but I was going down through there and saw many places where there is footer. Do I need to add those 2 lines any in every footer place?
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Adding page generate time at the bottom?
« Reply #4 on: March 14, 2005, 07:43:15 pm »

no, just theme.php
Logged

eagleknight

  • Coppermine newbie
  • Offline Offline
  • Posts: 6
Re: Adding page generate time at the bottom?
« Reply #5 on: March 16, 2005, 04:14:05 am »

Ok got it working, changed it a bit to get it look the way I wanted. Have a slight problem I also included query number and time, but it just shows 0 everytime. I edited the pagefooter section and here is my code, what is my mistake? My site is imagebutler.com if you want to see what it looks like at the bottom.

Code: [Select]
function pagefooter()
{
    global $HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_SERVER_VARS;
    global $USER, $USER_DATA, $ALBUM_SET, $CONFIG, $time_start, $query_stats, $queries;;
    global $template_footer;

    if ($CONFIG['debug_mode']==1 || ($CONFIG['debug_mode']==2 && GALLERY_ADMIN_MODE)) {
    cpg_debug_output();
    }

    //get info for query times
    $time_end = cpgGetMicroTime();
    $time = round($time_end - $time_start, 3);
    $query_count = count($query_stats);
        $query_times = '';
        $total_query_time = 0;
        foreach ($query_stats as $qtime) {
            $query_times .= round($qtime, 3) . "s ";
            $total_query_time += $qtime;
        }
        $total_query_time = round($total_query_time, 3);

    echo '<div class="footer" align="center" style="padding-top: 10px; font-size: 8pt;">';
    echo 'Page generated in ';
    echo $time;
    echo ' seconds - ';
    echo $query_count;
    echo ' queries in ';
    echo $total_query_time;
    echo ' seconds</div>';
   
    echo $template_footer;
}
Logged

foulu

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 236
  • uhm
Re: Adding page generate time at the bottom?
« Reply #6 on: March 16, 2005, 04:25:42 am »

not
global $USER, $USER_DATA, $ALBUM_SET, $CONFIG, $time_start, $query_stats, $queries;;
just
global $USER, $USER_DATA, $ALBUM_SET, $CONFIG, $time_start, $query_stats, $queries;

eagleknight

  • Coppermine newbie
  • Offline Offline
  • Posts: 6
Re: Adding page generate time at the bottom?
« Reply #7 on: March 16, 2005, 04:51:10 am »

Didn't work...still the same. If that was the problem I think it would have been sytax error and it would have failed to load page.
Logged

foulu

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 236
  • uhm
Re: Adding page generate time at the bottom?
« Reply #8 on: March 16, 2005, 05:15:22 am »

$query_stats, $queries only appear in debug mode so in normal mode it show all zero.

so go to function.php - function db_query($query, $link_id = 0) - line 82

change

          if (isset($CONFIG['debug_mode']) && (($CONFIG['debug_mode']==1) || ($CONFIG['debug_mode']==2) )) {
                $query_stats[] = $query_end - $query_start;
                $queries[] = $query;
          }
to

//          if (isset($CONFIG['debug_mode']) && (($CONFIG['debug_mode']==1) || ($CONFIG['debug_mode']==2) )) {
                $query_stats[] = $query_end - $query_start;
                $queries[] = $query;
//          }

to make it work

eagleknight

  • Coppermine newbie
  • Offline Offline
  • Posts: 6
Re: Adding page generate time at the bottom?
« Reply #9 on: March 16, 2005, 05:44:31 am »

Thank you! Worked like a charm.  ;D
Logged
Pages: [1]   Go Up
 

Page created in 0.022 seconds with 20 queries.