Customised templates: Difference between revisions

From Cumulus Wiki
Jump to navigationJump to search
m (→‎Changing the templates: example added)
m (→‎How Cumulus uses its templates: correcting information about temp suffix)
Line 3: Line 3:
=How Cumulus uses its templates=
=How Cumulus uses its templates=


Cumulus has a number of template files which it uses if you select to upload the standard files within Internet Configuration
Cumulus has a number of template files that it uses if you select to 'Include the standard files' within Internet Configuration:


[[File:SimpleInternet-StandardTicks.png]]
[[File:SimpleInternet-StandardTicks.png]]


The template files are stored in the 'web' folder under your Cumulus installation on your PC. They all have a 'T' (for 'template') in their names. As at version 1.9.2 the following exist:


The template files are stored in the 'web' folder under your Cumulus installation on your PC. They are named:


*indexT.htm
*indexT.htm
Line 18: Line 14:
*gaugesT.htm
*gaugesT.htm
*trendsT.htm
*trendsT.htm
... and any others (e.g. monthlyrecordT.htm in v.1.9.3) that may get added. They all have a 'T' (for 'template') in their names.


From v.1.9.3 another was added:
When Cumulus is ready to perform a web site update, it will process each of these files, insert the relevant data from the weather station and create temporary filenames for each. Once completed Cumulus will FTP these up to your web space on the internet. The filenames on your web site will be as above, without the letter T at the end.
*monthlyrecordT.htm

When Cumulus is ready to perform a web site update, it will process each of these files, insert the relevant data from the weather station and create local webpages (optionally with temp suffix) for each. Once completed Cumulus will FTP these up to your web space on the internet. The final filenames on your web site will be as above, without the letter T at the end.


=Changing the templates=
=Changing the templates=

Revision as of 18:14, 2 July 2013

It is possible to take the standard Cumulus web templates and customise these to your own requirements. A basic understanding of HTML is useful.

How Cumulus uses its templates

Cumulus has a number of template files that it uses if you select to 'Include the standard files' within Internet Configuration: SimpleInternet-StandardTicks.png

The template files are stored in the 'web' folder under your Cumulus installation on your PC. They all have a 'T' (for 'template') in their names. As at version 1.9.2 the following exist:

  • indexT.htm
  • todayT.htm
  • yesterdayT.htm
  • recordT.htm
  • gaugesT.htm
  • trendsT.htm

From v.1.9.3 another was added:

  • monthlyrecordT.htm

When Cumulus is ready to perform a web site update, it will process each of these files, insert the relevant data from the weather station and create local webpages (optionally with temp suffix) for each. Once completed Cumulus will FTP these up to your web space on the internet. The final filenames on your web site will be as above, without the letter T at the end.

Changing the templates

You can modify any of the template files mentioned above. For example, you may wish to add a link; remove some information; add a page counter; etc

It is best to close down Cumulus while updating the template files. Use windows Notepad or Notepad++ or another text editor to modify the HTML as necessary.

Typically the templates are modified to include additional weather data, or remove it. This is done with Cumulus webtags

Example

  <!-- Solar data. If you don't have a solar sensor, you may wish to delete everything from here to the next comment -->
  <tr class="td_temperature_data">
    <td>Solar Radiation</td>
    <td><#SolarRad> W/m²</td>
    <td>Evapotranspiration Today</td>
    <td><#ET> <#rainunit></td>
  </tr>
  <!-- End of solar data -->

The above code is in indexT.htm, delete all of it if you do not have a solar sensor on your weather station. The <#ET> web tag only applies to Davis weather stations that include a solar sensor, if your solar sensor is another make, you might want to change the code to the following so you can see your ultraviolet observation:

  <!-- Solar data. If you don't have a solar sensor, you may wish to delete everything from here to the next comment -->
  <tr class="td_temperature_data">
    <td>Solar Radiation</td>
    <td><#SolarRad> W/m²</td>
    <td>UV Index</td>
    <td><#UV></td>
  </tr>
  <!-- End of solar data -->

As soon as you edit templates, remember that when you update to a new build of Cumulus you have the option during the install process to decline overwriting your HTML templates if they are in the 'web' subfolder with the standard templates.

Notes of caution

  • Remember to edit the xxxT.htm files, (not the xxx.htm files) and to have 'Include Standard Files' ticked (as shown above).
  • Try to use a simple text editor to change the files. Many HTML editors will insert additional code, or break the standard Cumulus 'webtags' by replacing the < or > symbols with character codes. Avoid using Word processors, like Word, to edit these files.
  • Keep copies of any xxxT.htm files you modify. It is best to back up the whole Cumulus folder onto a different disc on a regular basis.
  • From version 1.8.9 onwards, the Cumulus installer installs the standard templates in a Cumulus subfolder called 'web/originals' so you can refer to them. The installer offers you the option of either replacing all templates in the 'web' folder, or not replacing them, if you update Cumulus or re-install the current version. If you select to install the templates, your changes will be lost as Cumulus will replace those in the 'web' folder with the standard ones.
  • If you are making anything but minor changes to the template, consider creating your own files with different names (in a separate folder), and list them for Cumulus to process these. Local files 0 to (from version 1.9.3) 99 can be listed in cumulus.ini; in this case have 'Include Standard Files' unticked. You will need to select both 'Process' and 'FTP' if your new files are replacement templates.