473,396 Members | 1,891 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,396 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 1190
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
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.