CSS + PHP Progress Bar

Ok, did it again. =) http://pctech.invisibill.net/testbar.php uses PHP server side includes to pull the percentage from a text file on the server. As you can see, http://pctech.invisibill.net/barprogress.txt simply contains “80”. The <? include(“barprogress.txt”) ?> tells PHP to open up the text file and insert its contents there. Instead of hard-coding the percentage in the progress bar code, I’m telling it to insert whatever number is in the text file.

This means that you can edit or upload a new barprogress.txt file to change the progress bar. You don’t even have to get into the code. It could be handled similarly to uploading a new image representing the current progress, or you could edit the text file on the server if you needed to. Even if you uploaded a new copy of the file for every change, the upload would still be smaller than sending a whole image every time.

Leave a Reply

Your email address will not be published. Required fields are marked *

Note: This post is over 5 years old. You may want to check later in this blog to see if there is new information relevant to your comment.