Php webtags: Difference between revisions

no edit summary
No edit summary
{{AddOnBanner|name=PHP Webtags|type=Web templates, PHP|author=Ray Beriau|contact='gemini06720' via forum|updated=26 Jan 2010|version=1.11}}
Cumulus automatically prepares a number of webpagesWeb pages 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 ininto 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.
=Usage=
 
Use the PHP [http://www.w3schools.com/PHP/php_includes.asp include / require] command to refer toinclude the Cumulus webtags ininto your PHP phpfile.
 
All PHP variable names are identical to their webtag[[webtags]] namesequivalent. For Example:example, the Cumulus webtag <tt><#forecast></tt> iswould be referred to in your php as <tt>$forecast</tt> in your PHP file.
 
 
=Example=
 
A simple PHP file :
 
<pre>
<?php
require_once("cumuluswebtags.php");
echo $time ;
echo "<br/>";
Echo "The current forecast is " . $forecast;
?>
</pre>
 
The results:
Result:
 
<pre>
<pre>20:31 on 02 September 2009
The current forecast is Precipitation, very unsettled</pre>
</pre>
 
=Debugging=
 
If you wish to view all the values contained withwithin the '''cumulswebtags.php''' file, append the parameter <tt>?source=view</tt> to the end of the URL.
 
Example
www.myweathersite.com/cumuluswebtags.php?source=view
 
This will listdisplay the source code of the file, listing all the variable names, theirthe values asCumulus sethas byassigned Cumulusto the webtags during it's processing cycle, and a brief description of eachthe webtagvariables/webtags.
 
[[Category:AddOns]]
12

edits