Display Query Count and Query Time in your Textpattern Pages

When running Textpattern in either debugging or testing mode, you’ll find the number of queries and the amount of time it took to build the page detailed in an HTML comment at the bottom of your page source code. However, when running in live mode, those comments are removed.

If you’d still like to display those numbers you can use the following code in your page template:

<txp:php>
  global $qcount,$qtime;
  echo comment($qcount." | ".$qtime);
</txp:php>

This will give you output as follows:

<!-- 36 | 0.192417 -->

This compact display differs slightly from the default display:

<!-- Query time: 0.192417 -->
<!-- Queries: 36 -->

If you’d like to display those numbers somewhere on your public site, the comment function would not be used:

<txp:php>
  global $qcount,$qtime;
  echo $qcount." | ".$qtime;
</txp:php>

Comments

Add a comment

You may use textile in your comment. Gravatars are enabled. Your email will not be displayed and will remain private. I reserve the right to edit or delete comments.





Textpattern Solutions

Textpattern Solutions

Textpattern Solutions is the first book published on Textpattern.

details at friends of ED or the official book website.

buy it at amazon.com