473,385 Members | 1,445 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,385 software developers and data experts.

Text color in php

93
Hi Again

How do I put a text color in case option? Eg I want the case:ALL the text will be red, case Dialogue the text is yellow, case Montage the text is blue and so on. What is the best way to modify these codes below?

Thnaks

nma

[PHP]
$events = (isset($_REQUEST['events']))?$_REQUEST['events']:"All";
switch($events) {
case "All":
$allEvents = $db->get_results("SELECT * FROM EventsShotsStartAndStopFrames where movieID='$movieID' order by startShot");

foreach($allEvents as $event)
{

$shotStartTime = $event->shotStartFrame/29.97;

if(is_int($event->shotStartFrame)) {
$shotStopTime = $event->shotStopFrame/29.97;
}
else {
$shotStopTime = 0;
}

$numberOfShotsInEvent = $event->endShot - $event->startShot;
$eventInformation = "$event->eventCategory <br />($numberOfShotsInEvent shots)<br />";
$eventInformation .= '<em style="font-size:smaller;">' . sec2hms($shotStartTime) . " - " . sec2hms($shotStopTime).'</em>';
insertEventTableRow($_GET['movieID'], $event->eventID, $event->imgSelectedKeyfrm, $shotStartTime, $shotStopTime, $eventInformation);
}
break;
case "Dialogue":
case "Montage":
case "Exciting":

$db->query("INSERT INTO LogsTable (page, action, userID, type, date) VALUES ('MB2eventlist', '$events categories', " . $_SESSION['user']->userID . ", '', getDate())");

$allEvents = $db->get_results("SELECT * FROM EventsShotsStartAndStopFrames where movieID='$movieID' and eventCategory = '$events' order by eventNo");

foreach($allEvents as $event)
{

$shotStartTime = $event->shotStartFrame/29.97;

if(is_int($event->shotStartFrame)) {
$shotStopTime = $event->shotStopFrame/29.97;
}
else {
$shotStopTime = 0;
}

$numberOfShotsInEvent = $event->endShot - $event->startShot;
$eventInformation = "<b>$events " . $event->eventNo . "</b><br />($numberOfShotsInEvent shots)<br />";
$eventInformation .= '<em style="font-size:smaller;">' . sec2hms($shotStartTime) . " - " . sec2hms($shotStopTime).'</em>';
insertEventTableRow($_GET['movieID'], $event->eventID, $event->imgSelectedKeyfrm, $shotStartTime, $shotStopTime, $eventInformation);
}
break;
default:
die("Invalid Event!");
break;
}

[/PHP]
Feb 7 '08 #1
8 2759
MarkoKlacar
296 Expert 100+
Hi,

Are we talking HTML output, or what kind of output are we talking?
Feb 7 '08 #2
nathj
938 Expert 512MB
Hi,

I would define the different layout/colour options in a CSS file and then within the case statement output the display using the relvant CSS class/selector or whatever.

Cheers
nathj
Feb 7 '08 #3
nma
93
[PHP]
function insertEventTableRow($movieID, $eventID, $keyFrame, $startTime, $stopTime, $eventInformation) {
?>
<tr bgcolor="#726257" onMouseOver="this.bgColor='#534741';" onMouseOut="this.bgColor='#726257';" style="cursor: pointer;">
<td width="65" valign="top" width="65" height="44" border="1" vspace="2">
<img src="<?php echo $keyFrame;?>"
onclick="parent.playClip(<?php echo $eventID?>, <?php echo $startTime;?>, <?php echo $stopTime;?>);parent.notesForm.eventID.value=<?php echo $eventID?>;parent.resetNotes();">
</td>
<td width="195" class="eventEntryText" onclick="parent.playClip(<?php echo $eventID?>, <?php echo $startTime;?>, <?php echo $stopTime;?>);parent.notesForm.eventID.value=<?php echo $eventID?>;parent.resetNotes();">
<?php echo $eventInformation?>
</td>
</tr>
<tr>
<td colspan="2" height="5">
<img src="iframe-borderline.jpg" width="230" height="5"/>
</td>
</tr>
<?php
}

[/PHP]


I'm so sorry..this is the function to display
thanks

nma
Feb 7 '08 #4
nma
93
[PHP]
<?php echo $Mov1->eventCategory;?>(<?php echo $Mov1->num_events;?>)

[/PHP]

Hi
How do I put the color for this line say green?


Thanks

nma
Feb 12 '08 #5
MarkoKlacar
296 Expert 100+
Hi,

If I understand you correctly, just punt <font>-tags around the php code and it should work fine.
Feb 13 '08 #6
nathj
938 Expert 512MB
Hi,

If I understand you correctly, just punt <font>-tags around the php code and it should work fine.
that involves merging content and style - a big pain when it comes to maintaining or changing the site and the behaviour. I would simply define three (or as many as needed) classes in the CSS that only differ interms of colour then you can apply thee depending no the branch of the case statement.

This means that should you need these colours again they are easy to use and should it be that they need to be changed then that is one change in one file - it's waht CSS is for.

Do the smart thing and use CSS for all your style control.

Cheers
nathj

PS I recently had to update a site (written by someone else) that had inline style for everything - it was a pain in the ass to find the content in the code!
Feb 13 '08 #7
nma
93
Thanks for those input...

I manage to put it as css in the <td> attributes..at it works

nma
Feb 13 '08 #8
nathj
938 Expert 512MB
Thanks for those input...

I manage to put it as css in the <td> attributes..at it works

nma
Hi nma,

I'm glad you got the desired result and that you managed it with CSS.

All the best with the rest of your project.

nathj
Feb 14 '08 #9

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

Similar topics

11
by: Ed Suominen | last post by:
I'm thinking of implementing a real-time collaborative text editor in Python using Twisted. An initial plan is to use a Twisted PB server daemon that accepts user:password:file connections from...
6
by: Suresh Kumaran | last post by:
Hi All, Does anybody know the sytax in VB.NET to write the contents of a multiline text box to a text file? Appreciate help. Suresh
27
by: Eric | last post by:
Assume that disk space is not an issue (the files will be small < 5k in general for the purpose of storing preferences) Assume that transportation to another OS may never occur. Are there...
3
by: Xerxes | last post by:
Hi, I need help in setting up a page where the text wraps around an image. Right now, I am using table, with text in one <td> and the image in the adjacent <td>. The problem is when the text is...
4
by: Arif Çimen | last post by:
Hi to everybody, I have chnged a button text in design mode. But After compiling and executing the program the text of the button do not change to new value. Any Ideas? Thaks for helps.
2
by: Buddy Ackerman | last post by:
Apparently .NET strips these white space characters (MSXML doesn't) regardless of what the output method is set to. I'm using <xsl:text> </xsl:text> to output a tab character and...
10
by: Nikolay Petrov | last post by:
How can I convert DOS cyrillic text to Unicode
3
by: jweinberg1975 | last post by:
I would like for users to be able to select from a small number of options that come from a little drop down menu which then closes. .....
2
by: george.leithead | last post by:
Hi all, I have a very strange problem! In following Web page (which is generated from a CMS System), the navigation to the left 'dissapears' when you roll the mouse over the links? It does not...
7
by: kirkgilbert | last post by:
I am trying to do an onchange event in a form using a text field. The form is tied to a record set that is part of a repeated region. One the first record when I edit the data it works perfectly. ...
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.