new: inline templates

Discussion about generation of graphs and tables
Post Reply
User avatar
admin
Site Admin
Posts: 332
Joined: Sun Feb 07, 2010 9:22 pm

new: inline templates

Post by admin » Sat Nov 12, 2011 9:17 am

I added a feature that allows to have template text embedded into a chart definition. In the past a template definition did always point to a file in the Internet, that gets handled as a template. So you always had to store the template seperately from the chart definition.

With the template directive "template=inline" the data following this statement is interpreted as the template. This should make handling of templates a bit more easy and you do not need to have additional web space to store your templates on.

The new inline feature is not tested thoroughly, so some bugs (especially when it includes special charactes) should be expected.

Example of an inline template definition:

Code: Select all

template=inline
<html>
  <head>
    <meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
    <title>Meteoplug HTML Mini-Dashboard</title>
  </head>
  <body bgcolor="#ffffff">
    <table border="1" cellpadding="0" cellspacing="2" width="550">
      <tr>
        <td>Actual Temperature</td>
        <td>[actual_min5_th0_temp_1:--] &deg;C ([actual_min5_th0_temp_1_1.8_32:--] &deg;F)</td>
      </tr>
      <tr>
        <td>Todays Max Temperature</td>
        <td>[actual_day1_th0_tempmax_1:--] &deg;C ([actual_day1_th0_tempmax_1_1.8_32:--] &deg;F)
           at [actual_day1_th0_tempmaxtime_11_5:--]</td>
      </tr>
      <tr>
        <td>Todays Min Temperature</td>
        <td>[actual_day1_th0_tempmin_1:--] &deg;C ([actual_day1_th0_tempmin_1_1.8_32:--] &deg;F) 
          at [actual_day1_th0_tempmintime_11_5:--]</td>
      </tr>
      <tr>                      
        <td>This Month's Max Temperature</td>
        <td>[actual_month1_th0_tempmax_1:--] &deg;C ([actual_month1_th0_tempmax_1_1.8_32:--] &deg;F) 
          at [actual_month1_th0_tempmaxtime:--]</td>
      </tr>
      <tr>
        <td>This Month's Min Temperature</td>
        <td>[actual_month1_th0_tempmin_1:--] &deg;C ([actual_month1_th0_tempmin_1_1.8_32:--] &deg;F)
           at [actual_month1_th0_tempmintime:--]</td>
      </tr>
      <tr>
        <td>Actual Humidity</td>
        <td>[actual_min5_th0_hum_0:--] %</td>
      </tr>
      <tr>
        <td>Actual Pressure</td>
        <td>[actual_min5_thb0_seapress_1:--] hPa ([actual_min5_thb0_seapress_2_0.02952] in/Hg)</td>
      </tr>
      <tr>
        <td>Actual Average Wind Speed</td>
        <td>[actual_min5_wind0_wind_1_3.6] km/h ([actual_min5_wind0_wind_1_2.237] mp/h)</td>
      </tr>
      <tr>
        <td>Todays Rainfall</td>
        <td>[actual_day1_rain0_total_1:--] mm ([actual_day1_rain0_total_2_0.0394:--] in)</td>
      </tr>
      <tr>
        <td>This Month's Rainfall</td>
        <td>[actual_month1_rain0_total_1:--] mm ([actual_month1_rain0_total_2_0.0394:--] in)</td>
      </tr>
    </table>
  </body>
</html>

skyewright
Posts: 69
Joined: Tue Mar 16, 2010 12:05 pm
Location: Isle of Skye
Contact:

Re: new: inline templates

Post by skyewright » Thu Dec 01, 2011 5:29 pm

admin wrote:The new inline feature is not tested thoroughly, so some bugs (especially when it includes special charactes) should be expected.
Excellent idea. The examples I have (which admitedly don't do anything very fancy) work fine with this new feature. Much more convenient than effectively having the definition spread across two files in different place.
Thank you. :)
David

Post Reply