I want to have a small text box with a scroll bar that will hold frequent outputs from PHP based on server-side activity. How do I set up formatting like this?
You can simply echo out a text box or input box and make the value a variable which you can set however you like:
Textbox
echo '<textarea>' . $value . '</textarea>';
Input
echo '<input type="text" value="' . $value . '" />';
You can make these read only, and adjust the other HTML attributes as you like. Hope this helps.
The box:
<iframe style="overflow:auto; width:100px" src="status.php"/>
And in status.php you parse a log file, as explained here
http://stackoverflow.com/questions/159393/how-can-i-parse-apaches-error-log-in-php
And you log interesting events/errors/warnings/debug in the log file.
I would either use a <pre>
or multiple <div>
s (one per line) instead of an input element. That way, you don't have to deal with making the input element read-only. If you use <div>
s, then you can also add classes to each line to style messages of different severity differently (for example, errors are red, warnings are orange etc.)
Maybe what you really want is something like Gmail or Facebook chat (sort of push messages into the browser).
If that's what you're looking for go after the keyword 'Comet' otherwise you can just use an AJAX repeater to query the page every 'x' seconds and fetch new messages.