Loading ...
Sorry, an error occurred while loading the content.

Conditional Formatting of output

Expand Messages
  • William D
    I was wondering if anyone could help me. I have the following table template that outputs stats from WUHU:
    Message 1 of 2 , Sep 24 3:03 PM
    • 0 Attachment
      I was wondering if anyone could help me. I have the following table template that outputs stats from WUHU:

      <meta http-equiv="refresh" content="300">

      <table border="1" cellpadding="10" align="center">

      <tr align=center><td bgcolor=#FFCC00 colspan=5><b>Daily Statistics</b><br><small>Updated: %TimeDateExcel%</small></td></tr>

      <tr align=center><td bgcolor=#6699FF><b>Observation</b></td><td bgcolor=#6699FF><b>Current</b></td><td bgcolor=#FF3300><b>Max</b></td><td bgcolor=#00FFFF><b>Min</b></td><td bgcolor=#FFFF99><b>Rate of Change</b></td></tr>

      <tr align=center><td bgcolor=#6699FF><small>Temperature</small></td><td><small>%OutdoorTempDegF%F</small></td><td><small>%[daily_extremes]high_outdoor_temperature_deg_F%F at %[daily_extremes]high_outdoor_temperature_time%</small></td><td><small>%[daily_extremes]low_outdoor_temperature_deg_F%F at %[daily_extremes]low_outdoor_temperature_time%</small></td><td><small>%[hourly_rates_of_change]outdoor_temperature_rate_deg_F%F/hr</small></b></td></tr>

      <tr align=center><td bgcolor=#6699FF><small>Feels Like</small></td><td><small>%OutdoorWindchillF%F</small></td><td><small>%[daily_extremes]high_outdoor_windchill_deg_F%F at %[daily_extremes]high_outdoor_windchill_time%</small></td><td><small>%[daily_extremes]low_outdoor_windchill_deg_F%F at %[daily_extremes]low_outdoor_windchill_time%</small></td><td><small>%[hourly_rates_of_change]outdoor_wind_chill_rate_deg_F%F/hr</small></td></tr>

      <tr align=center><td bgcolor=#6699FF><small>Humidity</small></td><td><small>%OutdoorHumidity%%</small></td><td><small>%[daily_extremes]high_outdoor_humidity%% at %[daily_extremes]high_outdoor_humidity_time%</small></td><td><small>%[daily_extremes]low_outdoor_humidity%% at %[daily_extremes]low_outdoor_humidity_time%</small></td><td><small>%[hourly_rates_of_change]outdoor_humidity_rate%%/hr</small></td></tr>

      <tr align=center><td bgcolor=#6699FF><small>Dewpoint</small></td><td><small>%OutdoorDewpointF%F</small></td><td><small>%[daily_extremes]high_outdoor_dewpoint_deg_F%F at %[daily_extremes]high_outdoor_dewpoint_time%</small></td><td><small>%[daily_extremes]low_outdoor_dewpoint_deg_F%F at %[daily_extremes]low_outdoor_dewpoint_time%</small></td><td><small>%[hourly_rates_of_change]outdoor_dewpoint_rate_deg_F%F/hr</small></td></tr>


      <tr align=center><td bgcolor=#6699FF><small>Wind</small></td><td><small>%OutdoorWindDirectionLetters%, %OutdoorWindSpeedMPH% mph</small></td><td><small>%[daily_extremes]high_outdoor_wind_direction_letters%, %[daily_extremes]high_outdoor_wind_gust_mph% mph at %[daily_extremes]high_outdoor_wind_speed_time%</small></td><td><small>%[daily_extremes]low_outdoor_wind_direction_letters%, %[daily_extremes]low_outdoor_wind_gust_mph% mph at %[daily_extremes]low_outdoor_wind_speed_time%</small></td><td><small>%[hourly_rates_of_change]outdoor_wind_speed_rate_mph% mph/hr</small></td></tr>

      <tr align=center><td bgcolor=#6699FF><small>Pressure</small></td><td><small>%OutdoorPressureRelativeINHG% inHg</small></td><td><small>%[daily_extremes]high_outdoor_relative_pressure_inHg% inHg at %[daily_extremes]high_outdoor_relative_pressure_time%</small></td><td><small>%[daily_extremes]low_outdoor_relative_pressure_inHg% inHg at %[daily_extremes]low_outdoor_relative_pressure_time%</small></td><td><small>%[hourly_rates_of_change]outdoor_relative_pressure_rate_inHg% inHg/hr</small></td></tr>

      </table>

      <br>

      <table border="1" cellpadding="2" align="center">

      <tr align=center><td bgcolor=#66FF00 colspan=3><b>Rainfall</b></td></tr>

      <tr align=center><td bgcolor=#66FF00><b>Last Hour</b></td><td bgcolor=#66FF00><b>Daily Total</b></td><td bgcolor=#66FF00><b>Monthly Total</b></td></tr>

      <tr align=center><td><small>%OutdoorRain1HrIN% in</small></b></td><td><small>%[rain_daily]inch% in</small></b></td><td><small>%[rain_total_monthly]inch% in</small></b></td></tr>

      </table>

      This template produces the following PHP file on my site:

      http://www.marylandwx.com/wuhu/dailyobs.php

      I would like to use PHP to apply conditional formatting to the Rate of Change cells. I would like the cell to be red if the rate is negative and green if positive.

      I had done this a long time ago with another table, but cannot for the life of me remember how I did it.

      Anyone know how to do it?

      Thanks!
    • Don Lafferty
      Do you have the actual php file? A link to a php file doesn t do any good because the php parser removes all the actual php. You ll just need an if statement.
      Message 2 of 2 , Sep 24 3:15 PM
      • 0 Attachment
        Do you have the actual php file?  A link to a php file doesn't do any good because the php parser removes all the actual php.

        You'll just need an if statement.  

        if (case)
        do something;
        else 

        Don

        On Sat, Sep 24, 2011 at 3:03 PM, William D <wdepriest@...> wrote:
         

        I was wondering if anyone could help me. I have the following table template that outputs stats from WUHU:

        <meta http-equiv="refresh" content="300">

        <table border="1" cellpadding="10" align="center">

        <tr align=center><td bgcolor=#FFCC00 colspan=5><b>Daily Statistics</b><br><small>Updated: %TimeDateExcel%</small></td></tr>

        <tr align=center><td bgcolor=#6699FF><b>Observation</b></td><td bgcolor=#6699FF><b>Current</b></td><td bgcolor=#FF3300><b>Max</b></td><td bgcolor=#00FFFF><b>Min</b></td><td bgcolor=#FFFF99><b>Rate of Change</b></td></tr>

        <tr align=center><td bgcolor=#6699FF><small>Temperature</small></td><td><small>%OutdoorTempDegF%F</small></td><td><small>%[daily_extremes]high_outdoor_temperature_deg_F%F at %[daily_extremes]high_outdoor_temperature_time%</small></td><td><small>%[daily_extremes]low_outdoor_temperature_deg_F%F at %[daily_extremes]low_outdoor_temperature_time%</small></td><td><small>%[hourly_rates_of_change]outdoor_temperature_rate_deg_F%F/hr</small></b></td></tr>

        <tr align=center><td bgcolor=#6699FF><small>Feels Like</small></td><td><small>%OutdoorWindchillF%F</small></td><td><small>%[daily_extremes]high_outdoor_windchill_deg_F%F at %[daily_extremes]high_outdoor_windchill_time%</small></td><td><small>%[daily_extremes]low_outdoor_windchill_deg_F%F at %[daily_extremes]low_outdoor_windchill_time%</small></td><td><small>%[hourly_rates_of_change]outdoor_wind_chill_rate_deg_F%F/hr</small></td></tr>

        <tr align=center><td bgcolor=#6699FF><small>Humidity</small></td><td><small>%OutdoorHumidity%%</small></td><td><small>%[daily_extremes]high_outdoor_humidity%% at %[daily_extremes]high_outdoor_humidity_time%</small></td><td><small>%[daily_extremes]low_outdoor_humidity%% at %[daily_extremes]low_outdoor_humidity_time%</small></td><td><small>%[hourly_rates_of_change]outdoor_humidity_rate%%/hr</small></td></tr>

        <tr align=center><td bgcolor=#6699FF><small>Dewpoint</small></td><td><small>%OutdoorDewpointF%F</small></td><td><small>%[daily_extremes]high_outdoor_dewpoint_deg_F%F at %[daily_extremes]high_outdoor_dewpoint_time%</small></td><td><small>%[daily_extremes]low_outdoor_dewpoint_deg_F%F at %[daily_extremes]low_outdoor_dewpoint_time%</small></td><td><small>%[hourly_rates_of_change]outdoor_dewpoint_rate_deg_F%F/hr</small></td></tr>

        <tr align=center><td bgcolor=#6699FF><small>Wind</small></td><td><small>%OutdoorWindDirectionLetters%, %OutdoorWindSpeedMPH% mph</small></td><td><small>%[daily_extremes]high_outdoor_wind_direction_letters%, %[daily_extremes]high_outdoor_wind_gust_mph% mph at %[daily_extremes]high_outdoor_wind_speed_time%</small></td><td><small>%[daily_extremes]low_outdoor_wind_direction_letters%, %[daily_extremes]low_outdoor_wind_gust_mph% mph at %[daily_extremes]low_outdoor_wind_speed_time%</small></td><td><small>%[hourly_rates_of_change]outdoor_wind_speed_rate_mph% mph/hr</small></td></tr>

        <tr align=center><td bgcolor=#6699FF><small>Pressure</small></td><td><small>%OutdoorPressureRelativeINHG% inHg</small></td><td><small>%[daily_extremes]high_outdoor_relative_pressure_inHg% inHg at %[daily_extremes]high_outdoor_relative_pressure_time%</small></td><td><small>%[daily_extremes]low_outdoor_relative_pressure_inHg% inHg at %[daily_extremes]low_outdoor_relative_pressure_time%</small></td><td><small>%[hourly_rates_of_change]outdoor_relative_pressure_rate_inHg% inHg/hr</small></td></tr>

        </table>

        <br>

        <table border="1" cellpadding="2" align="center">

        <tr align=center><td bgcolor=#66FF00 colspan=3><b>Rainfall</b></td></tr>

        <tr align=center><td bgcolor=#66FF00><b>Last Hour</b></td><td bgcolor=#66FF00><b>Daily Total</b></td><td bgcolor=#66FF00><b>Monthly Total</b></td></tr>

        <tr align=center><td><small>%OutdoorRain1HrIN% in</small></b></td><td><small>%[rain_daily]inch% in</small></b></td><td><small>%[rain_total_monthly]inch% in</small></b></td></tr>

        </table>

        This template produces the following PHP file on my site:

        http://www.marylandwx.com/wuhu/dailyobs.php

        I would like to use PHP to apply conditional formatting to the Rate of Change cells. I would like the cell to be red if the rate is negative and green if positive.

        I had done this a long time ago with another table, but cannot for the life of me remember how I did it.

        Anyone know how to do it?

        Thanks!




        --
        The day Microsoft starts making vacuum cleaners is the day they start making something that doesn't suck.
      Your message has been successfully submitted and would be delivered to recipients shortly.