12
edits
Gemini06720 (talk | contribs) |
Gemini06720 (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
{{AddOnBanner|name=PHP Webtags|type=Web templates, PHP|author=Ray Beriau|contact='gemini06720' via forum|updated=26 Jan 2010|version=1.11}} | {{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 | Cumulus automatically prepares a number of Web 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 | For those using PHP on their website it is possible to have Cumulus process one single file and place all the [[webtags]] values into a file of PHP variables. You can include this file in all your PHP webfiles and use the variables as you would in PHP. | ||
The PHP file contains all current [[webtags]] produced by Cumulus. | The PHP file contains all current [[webtags]] produced by Cumulus. | ||
Line 30: | Line 30: | ||
=Usage= | =Usage= | ||
Use the PHP [http://www.w3schools.com/PHP/php_includes.asp include / require] command to | Use the PHP [http://www.w3schools.com/PHP/php_includes.asp include/require] command to include the Cumulus webtags into your PHP file. | ||
All PHP variable names are identical to their | All PHP variable names are identical to their [[webtags]] equivalent. For example, the Cumulus webtag <tt><#forecast></tt> would be referred to as <tt>$forecast</tt> in your PHP file. | ||
=Example= | =Example= | ||
A simple PHP file | A simple PHP file: | ||
<pre> | <pre> | ||
<?php | <?php | ||
require_once("cumuluswebtags.php"); | require_once("cumuluswebtags.php"); | ||
echo $time ; | echo $time; | ||
echo "<br/>"; | echo "<br/>"; | ||
Echo "The current forecast is " . $forecast; | Echo "The current forecast is " . $forecast; | ||
?> | ?> | ||
</pre> | </pre> | ||
The results: | |||
<pre>20:31 on 02 September 2009 | <pre> | ||
The current forecast is Precipitation, very unsettled</pre> | 20:31 on 02 September 2009 | ||
The current forecast is Precipitation, very unsettled | |||
</pre> | |||
=Debugging= | =Debugging= | ||
If you wish to view all the values contained | If you wish to view all the values contained within the '''cumulswebtags.php''' file, append the parameter <tt>?source=view</tt> to the end of the URL. | ||
Example | Example | ||
www.myweathersite.com/cumuluswebtags.php?source=view | www.myweathersite.com/cumuluswebtags.php?source=view | ||
This will | This will display the source code of the file, listing all the variable names, the values Cumulus has assigned to the webtags during it's processing cycle, and a brief description of the variables/webtags. | ||
[[Category:AddOns]] | [[Category:AddOns]] |
edits