Relja12 Posted February 20, 2018 Report Posted February 20, 2018 Hey guys! I have a problem when coding this: <li class="list-group-item"> <b>Rank Progress</b> <div style="width: 80%;display: inline;" class="progress-group"> <span class="progress-number">XX%</span> <div class="progress sm"> <div class="progress-bar progress-bar-blue-light" style="width: XX%"></div> </div> </div> </li> I want to add code to display precentage to next rank and progress bar with it. Does someone have an idea? I would appreciate any help! Thanks, Relja Quote
web541 Posted February 21, 2018 Report Posted February 21, 2018 Check here https://forum.phpvms.net/topic/8681-percentage-to-rank/ Quote
Relja12 Posted February 21, 2018 Author Report Posted February 21, 2018 Hey web541, Thank you for getting back to me. But as I am new to coding all those stuff, I dont understand what they want to say. If you could specify what do I have to edit in my code or is it even possible to use it? Thank you again, Relja Quote
CarlosEduardo2409 Posted February 21, 2018 Report Posted February 21, 2018 (edited) @Relja12 Try this <li class="list-group-item"> <b>Rank Progress</b> <?php $percentage = ($pilot_hours/$nextrank->minhours) * 100; ?> <?php $round = round($percentage); ?> <div style="width: 80%;display: inline;" class="progress-group"> <span class="progress-number"><?php echo $round ?>% Completed</span> <div class="progress sm"> <div class="progress-bar progress-bar-blue-light" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style='width: ", <?php echo $round ?>, "%'></div> </div> </div> </li> Code by: Alp Yeni Edited February 21, 2018 by CarlosEduardo2409 Quote
Relja12 Posted February 21, 2018 Author Report Posted February 21, 2018 Hi Carlos, First of all, thank you for your response. Now, I get this in place where progress bar should be: Rank Progress //Calculate percentage to next rank. // Round percentage because xxx.x% is not good for CSS. 4% Completed // Progress bar percentage // Create progress bar // Progress bar inner Quote
CarlosEduardo2409 Posted February 21, 2018 Report Posted February 21, 2018 Please, refresh the page, and get the code again. Quote
Relja12 Posted February 21, 2018 Author Report Posted February 21, 2018 Okay, now the code works but for some reason progress bar is missing. Any idea? Quote
CarlosEduardo2409 Posted February 21, 2018 Report Posted February 21, 2018 Try this: <li class="list-group-item"> <b>Rank Progress</b> <?php $percentage = ($pilot_hours/$nextrank->minhours) * 100; ?> <?php $round = round($percentage); ?> <div style="width: 80%;display: inline;" class="progress-group"> <span class="progress-number"><?php echo $round ?>% Completed</span> <div class="progress sm"> <?php echo "<div class='progress-bar progress-bar-blue-light' role='progressbar' aria-valuenow='60' aria-valuemin='0' aria-valuemax='100' style='width: ", $round, "%'></div>"; // Progress bar inner ?> </div> </div> </li> 1 Quote
Relja12 Posted February 21, 2018 Author Report Posted February 21, 2018 Now it works perfectly fine! Thank you very much Carlos! Best regards, Relja Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.