Php webtags

From Cumulus Wiki
Revision as of 19:55, 2 September 2009 by Daj (talk | contribs) (initial creation)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search
Name: PHP Webtags
Type: Web templates, PHP
Author: Ray Beriau
Contact: 'gemini06720' via forum
Last update: 17 Aug 2009
Version: 1.01

Cumulus automatically prepares a number of webpages by using HTML template files. These files contain webtags which Cumulus replaces with actual values from your weather station.

For those using PHP on their website it is possible to have Cumulus process one single file and place all the webtags values in a file of PHP variables. You can include this file in all your PHP webfiles and use the variables as you would any other in PHP.

The PHP file contains all current webtags produced by Cumulus.


Installation

ScreenShot-PHPWebtags-ConfigSetup.png
  • Rename it as cumuluswebtags.php and place it in the Cumulus data folder or any other location Cumulus can access.
  • Click the 'Configuration' menu then 'Internet'
  • In an empty slot provide the local filename where you have stored the file you just downloaded.
  • In the 'remote filenames' provide the full path and filename to upload onto your webserver.
  • Tick the 'Process' and 'FTP' boxes. This tells Cumulus that the 'local filename' contains webtags and it will replace these with actual values. The FTP option will ensure it is uploaded to your webserver with all other files.


Usage

Use the PHP include / require command to refer to the Cumulus webtags in php.

All PHP variable names are identical to their webtag names. Example: the Cumulus webtag <#forecast> is referred to in your php as $forecast


Example

A simple PHP file

<?php 
require("cumulustags.php");
echo $time ;
echo "<br/>";
Echo "The current forecast is " . $forecast;
?>

Result:

20:31 on 02 September 2009
The current forecast is Precipitation, very unsettled


Debugging

If you wish to view all the values contained with the cumulswebtags.php file append the parameter ?sce=view to the end of the URL.

Example

www.myweathersite.com/cumuluswebtags.php?sce=view

This will list all the variable names, their values as set by Cumulus during it's processing, and a brief description of each webtag