Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 07-02-2005, 04:21 PM Progress bar?
Extreme Talker

Posts: 219
Location: UK, East Anglia
Trades: 0
How would i make something using PHP like this:



To use to show my progess on a project?
timsquash5 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-02-2005, 07:30 PM
Republikin's Avatar
Defies a Status

Posts: 3,189
Trades: 3
Ok....I'm thinking of the poor mans way which is probably less ideal but should be functional nonetheless (at least in theory)...

PHP Code:
<?php
$intTotal 
50;
$intProgress 44;
$intDifference = ($intTotal $intProgress);
?>

<table width="<?php echo $intTotal?>">
    <tr>
        <td width="<?php echo $intProgress?>" bgcolor="#009900">&nbsp;</td>
        <td width="<?php echo $intDifference?>" bgcolor="#FF0000">&nbsp;</td>
    </tr>
</table>
Something about that just feels awkward though, perhaps someone will point it out.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Republikin is offline
Reply With Quote
View Public Profile
 
Old 07-02-2005, 09:07 PM
onlyplace4's Avatar
Extreme Talker

Posts: 159
Location: Skegness, Lincolnshire, England
Trades: 0
Try this:

PHP Code:
<?php
$intTotal 
50;
$intProgress 44;
$intDifference = ($intTotal $intProgress);
echo 
"capacity: <img src='green.jpg' width='$intProgress' height='20' border='0'>";
if (
$intDifference != 0) {
     echo 
"<img src='red.jpg' width='$intDifference' height='20' border='0'>";
}
echo 
$intProgress/$intTotal";
?>
You'll need to make two small one pixel wide jpgs, one red and one green, to make this work. You can even bevel the edges of the jpgs if you want to. The 'if' checks to make sure you haven't reached capacity as you can't have an image that is 0 pixels wide. Of course, if you haven't started the project and $intProgress = 0, then you will need a similar test for the first image.

Hope that works for you.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
onlyplace4 is offline
Reply With Quote
View Public Profile Visit onlyplace4's homepage!
 
Reply     « Reply to Progress bar?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.11450 seconds with 12 queries