Php webtags: Difference between revisions

119 bytes added ,  13:15, 28 January 2010
no edit summary
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 webpages by using HTML template files.  These files contain [[webtags]] which Cumulus replaces with actual values from your weather station.
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 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.
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 refer to the Cumulus webtags in php.   
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 webtag names. Example: the Cumulus webtag <tt><#forecast></tt> is referred to in your php as <tt>$forecast</tt>
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>


Result:
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 with the cumulswebtags.php file append the parameter <tt>?source=view</tt> to the end of the URL.   
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 list all the variable names, their values as set by Cumulus during it's processing, and a brief description of each webtag
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]]
12

edits