PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
here's my question, i want to uses my code to get parse time, but i want to display parse time on the bottom of my menu instead of at the bottom of the page, i have to have the second part of the code at the end of my script to get true parse time, is there a way to printf the time above the second bunch of code?!?!?!?!
Hmm, the way I would do it is use Javascript. In the menu, create a little element with a certain id, lets say x_id. Then, at the end of your file, output some javascript that changes the contents of x_id (it may be easier to use a form element) to whatever. That way, you can wait until the page is parsed and output before you have to set the element in your menu.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
dull1554 wrote:sorrymaybe i was not using ob_start and such correctly...it just makes the parse time say 0.000000....
When you try to print value of $totaltime you're using an unitialisetd var - so $totaltime has value of 0...
IMHO you should try solution as written above - put some HTML object where you want to have that $totaltime shown, and when finishing page, do something like echo "myObject.value = $totaltime;"
Yes, you have to replace myObject with proper statement (document.getEmelentById(), form., etc) and you have it
Just had a brainstorm here. What if throughout the page, you don't echo any HTML, but just store it in variables. Then, when the page is parsed and ready to go, you can set your time variable which will change the HTML you've generated, and output all the variables that you've already created. All the work except actually echoing the code will be done while you're timing. This may be quite messy (in fact I'm almost positive it is), but it would work.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.