I'm trying to determine the page parse time of a 3rd-party application. I only have access to the Smarty Templates. Can I use inline PHP to display the actual parse time, or is processing time done outside of the smarty template? Using some code from one of Chemo's osCommerce contributions: The first line of my top smarty template is: {php}define('PAGE_PARSE_START_TIME', microtime());{/php} PHP: The last line of my bottom smarty template is: {php} $time_start = explode(' ', PAGE_PARSE_START_TIME); $time_end = explode(' ', microtime()); $parse_time = number_format(($time_end[1] + $time_end[0] - ($time_start[1] + $time_start[0])), 3); echo '<span class="smallText">Current Parse Time: <b>' . $parse_time . ' s</span>'; {/php} PHP: This method is displaying a time, but I'm not sure exactly how Smarty processes things, and whether this is really the parse time, or if processing happens outside of the templates.
it is all done through that code you posted above The first statement gets the current time at the start of the page, and saves it in a CONSTANT VARIABLE PAGE_PARSE_START_TIME [FONT='Courier New',Courier,monospace]{php}[/FONT] // The pages start time [FONT='Courier New',Courier,monospace]$time_start = explode(' ', PAGE_PARSE_START_TIME);[/FONT] // The time it currently is when the process stops [FONT='Courier New',Courier,monospace]$time_end = explode(' ', microtime());[/FONT] // Make it into a time formated number, determining total time by subtracting end from start [FONT='Courier New',Courier,monospace]$parse_time = number_format(($time_end[1] + $time_end[0] - ($time_start[1] + $time_start[0])), 3);[/FONT] // Echo it out. [FONT='Courier New',Courier,monospace]echo '<span class="smallText">Current Parse Time: <b>' . $parse_time . ' s</span>';[/FONT] [FONT='Courier New',Courier,monospace]{/php} [/FONT]
Unless if the third party script is called by including it from within Smarty (e.g.: using {include_php} or {php}include(...);{/php}, doing the time calculation from Smarty will just calculate Smarty's parsing time. i.e.: not that useful.
phper, That is what I was questioning. There are no third party scripts being called from within the Smarty templates that I can see. Is there any way for me to tell if the number I am getting is just the Smarty parsing time? Thanks