Solved

Conditional Formatting in Dreamweaver Table

Posted on 2010-08-23
10
709 Views
Last Modified: 2013-12-13
I am using Dreamweaver to create a "Dynamic" information table.  It is setup as a repeat region and pulls data from a MySQL database.  One of the cells of data contains the values "Hot" or “Medium" or “Cool"  The user decides when they enter the data.  This is held in a dropdown menu.  I would like to highlight the row that has "Hot" red. My table of data is as follows

First Name    Last Name    Etc    Etc   Hot
So this row needs to be highlighted red.

I can do this in Access but how can I do it in Dreamweaver or CSS or something else?
Thanks
0
Comment
Question by:napsternova
  • 5
  • 5
10 Comments
 
LVL 3

Expert Comment

by:wmcdon7160
ID: 33501338
Do you want it to highlight red when it pulls an existing row from the database, when you user selects it as a new entry, or both?
0
 

Author Comment

by:napsternova
ID: 33501419
Hmmm, both would be impressive but ultimately the row in the "report" table.  I have a couple CSS scripts already attatched.
0
 
LVL 3

Expert Comment

by:wmcdon7160
ID: 33501456
Can you post the code that repeats the result row?
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:napsternova
ID: 33502515
<?php do { ?>
              <tr class="<?php echo @$cnt1++%2==0 ? "" : "KT_even"; ?>">
                <td><input type="checkbox" name="kt_pk_Leads" class="id_checkbox" value="<?php echo $row_Recordset1['LeadID']; ?>" />
                  <input type="hidden" name="LeadID" class="id_field" value="<?php echo $row_Recordset1['LeadID']; ?>" /></td>
                <td><div class="KT_col_LeadFirstName"><?php echo KT_FormatForList($row_Recordset1['LeadFirstName'], 20); ?></div></td>
                <td><div class="KT_col_LeadLastName"><?php echo KT_FormatForList($row_Recordset1['LeadLastName'], 20); ?></div></td>
                <td><div class="KT_col_ContactLevel"><?php echo KT_FormatForList($row_Recordset1['ContactLevel'], 20); ?></div></td>
              </tr>
              <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
0
 

Author Comment

by:napsternova
ID: 33504588
Should I post something else?  
0
 
LVL 3

Expert Comment

by:wmcdon7160
ID: 33504626
Sorry, had that nagging "day job" to tend to... :)

what does <?php echo @$cnt1++%2==0 ? "" : "KT_even"; ?> look like in your CSS?
0
 

Author Comment

by:napsternova
ID: 33505433
Pretty sure that represents alernating row colors, white for the odd and gray for the even.  The hightlight (rollover) color is green.  Day job?  Yeah they tend to get in the way.  :)
0
 
LVL 3

Expert Comment

by:wmcdon7160
ID: 33507978
How familiar with PHP are you? It would appear from the code that you are probably just using the drag/drop functionality of Dreamweaver.

I ask, because I would suggest putting some PHP conditionality into the TR that points to conditional CSS, and didn't know how detailed to be...
0
 

Author Comment

by:napsternova
ID: 33510945
wmcdon7160,
PHP I can handle but CSS not so much.  I have been using the original version of the Adobe toolbox because it works really well.  It does seem to add a lot of extra code but it generates forms and tables that are really clean looking.  I use the Conditional functionality in MS Access all the time but never on the web.  This would be a great tool I can use for many things, like checking dates and sending reminders, highlighting fields when a certain date comes around, highlight table rows to bring attention, etc.  I would like to understand how to do this.  If I should read up on CSS I can do that too, and sounds like I probably should.
Thanks,
Jeff
0
 
LVL 3

Accepted Solution

by:
wmcdon7160 earned 250 total points
ID: 33511613
Make a new CSS class called "hot", or whatever.
It will look a lot like the KT_EVEN class.

Then add an IF statement (or DO WHILE) in the <tr> code.
I would try something like the following:
[it's separated on different lines for clarity]


<tr class="
<?php echo @$cnt1++%2==0 ? "" : "KT_even"; ?>
<?PHP IF ($row_Recordset1['ContactLevel'] == "hot") 
  {echo " hot";} ?>
">

Open in new window

0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question