Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 07-16-2004, 06:59 PM   #1
Registered: Oct 2003
Location: D.C USA
Distribution: Redhat 9. Thinking about Slackware
Posts: 166

Rep: Reputation: 30
PHP table color change

Ok, this is a good one that i have been playing with for a while. We have a tickett tracking system at work that i developed. all ticketts that are open for a department are displayed in a dynamic table, being displayed is the time due which is enterd when the tickett is open. I want the row colors in the table to change depending on how much time is left in the tichett. so if there is less than an hour left i want the background to be red with the font in white, if there is less than 2 hours left i want the row to have a orange background with white font. all records that have more than 2 hours left are displaying white background with black font.

I have played with this for a few weeks and have gotten no where.
Old 07-16-2004, 08:33 PM   #2
Registered: Oct 2003
Location: Canada
Posts: 699

Rep: Reputation: 47
I'm not an expert in PHP or coding in any language. I'll clear that up right now. But I will say a few things, seeing how no one has replied to your post yet.

I dont really understand what you mean, but time left. I'm not sure what your ticket tracking system is, but I once worked at an ISP as a support tech, and we wrote tickets there on a webbased system using php, but all it did was record what was wrong with the clients computers and what we tried to fix them. We recorded this information incase our solution didn't fix the clients problem and when they called back, if it wasn't the same tech that helped them before, they could read the ticket to find out what has happened.

So if you reply, please let me know what it is your doing, i'm interested.

So to help you on a technical basis. If you want to change background colors and such, I'm not even sure if thats possible to do dynamically with PHP, as PHP i'm sure you know is server side. So if your running a webserver on the computer that is using your webbased php system, I suppose you could set the page to refresh every so often and check the time. Depending on what the time is, it could set the colours appropriately. This wouldn't be that hard to set up with Apache, as it is free, and install in seconds with php support. But its somewhat impractical.

I would suggest using PHP to write a dynamic javascript function that can change colors. So it could be something like this.


echo '
<Script language="javascript">

function changecolours()
   //check current time and compare with timeleft
   //then using the DOM of javascript change the colours of the page.
   //Run this function again in 60 seconds



<body onload="changecolours();">


Of course that was just out of the top of my head, I'm not sure what the actual commands would be, but I'm sure that wouldn't be too hard to set up. You could call the function to change the colours every 5 minutes to check the current times over and over again, so when it finally is time to change the colours, it would.

Hope this helps somewhat. or perhaps I've just mega wasted my time.

Good luck.


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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
change color vito_huang Linux - General 1 11-13-2004 01:21 PM
java change color alaios Programming 2 05-29-2004 12:45 PM
ls --color 'color change' ekdya Linux - General 1 10-06-2003 03:47 PM
counsol color change crealkillerI75 Slackware 8 07-27-2002 06:36 AM
how to change bg and fg color in emacs linux_rookie Linux - Software 1 06-23-2001 07:48 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:37 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration