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

Commenting is closed for this article.

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