473,320 Members | 1,947 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

I have a php script with me. I have a doubt on a few lines of script regarding progre

I have a doubt regarding this script
This is defined about a progress bar

Expand|Select|Wrap|Line Numbers
  1. public function progressBarStatus($number)
  2.       {
  3.           return ($number == 0) ? lang('NOTSTARTED') : '<div class="progress-bar ui-progressbar ui-widget ui-widget-content"><div class="inner-orange ui-corner-left" style="width:' . $number . '%;">' . $number . '%**</div></div>';
  4.       }
See I want the progress bar to have orange colour only when score is below 70%

The code for determining score is

Expand|Select|Wrap|Line Numbers
  1. <td><?php echo $row->score;?>% <?php echo $content->progressBarStatus(intval($row->marks/$row->fullmarks*100));?> (<?php echo intval($row->marks);?>/<?php echo intval($row->fullmarks);?>)</td>
What changes should I make?

Now what's happening by default it is showing orange colour for all scores. The other colour is green what I want its there in lib.php. Just tell me How I should reframe the other code like using if else or something
Jun 28 '15 #1
1 1186
computerfox
276 100+
1) I want to point out that this is not a "script" because you have HTML objects. A script is something that simply runs the instructions you build into it. For example, a shell script.

2) I don't see any conditional statements (if, else if, else) so it's not checking for your requirements

3) I would suggest starting by cleaning up your code
a. Line up the brackets with the function name or bring the first bracket up to the same
line. No use in wasting a new line for just a bracket.
b. The function only has one really long line that it returns. Break down the return
statement
c. The HTML should be broken into new lines. The td's should be separate lines
Jun 28 '15 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: James Pittman | last post by:
Hi, I have a PHP script running in a Cron job in Unix, using the "php" command-line command executable. How do I get the path to the script, from within the script? I've tried all the $_SERVER...
4
by: Simon Wigzell | last post by:
My webpage assembles data from a database for display as an html webpage. I would to have the ability for my clients to have custom scripts to control the display. I would like the behaviour of...
2
by: Steve Henderson | last post by:
I have really surprised myself and written a script that actually works! <grin>. As you will be able to tell, I'm really, really new to this scripting stuff... My script does a task and then sleeps...
1
by: Benoit Fries | last post by:
Hello, I have some problems with a Javascript that should redirect me to another page, it works fine most of the times but sometimes it hangs on a blank page. I made lots of tests and finally...
4
by: David | last post by:
Hi, I am new to DB2. Does someone have a sample DB2 script they can post here? All I want to do is execute a SQL query like this: SELECT * FROM TABLE Also, can someone post a sample AIX...
17
by: CES | last post by:
All, I was wondering if their is a way of loading an external script fill from within a script?? <script language="javascript" type="text/javascript"> function test(var){ <script...
2
by: sangeetha | last post by:
hi everybody i want to run one perl script with three inputs inside the expect script i dont know how to automatically run the perl script with three inputs .... can u please guide me...
3
by: kal | last post by:
Hi I have a aspx page that has a function in a script tag which is called from code in a javascript src file that is loaded in the <headtag. the thing is that that browser complains that it...
1
by: sophie_newbie | last post by:
Hi, I'm running a python script which if I run from the command line as root runs fine. But if I run it through the web-browser as a cgi script gives the following error "Error in X11: unable to...
7
by: jerald m | last post by:
Hi please anybody help me.. <script language="java" type="text/javascript" src="datetimepicker.js"> in the script i add src="datetimepicker.js". For combo box also i put some scripting for...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.