Php webtags: Difference between revisions

197 bytes added ,  19:49, 20 April 2020
m
Line 121: Line 121:
== Usage ==
== Usage ==


Use the PHP [http://www.w3schools.com/PHP/php_includes.asp include/require] command to include the Cumulus web tags into your PHP file.  Then where you would insert a web tag if you were writing a template, you insert a command to "echo" the php variable <pre><?=$PHP_variable_name[any_index_needed];?></pre>
Use the PHP [http://www.w3schools.com/PHP/php_includes.asp include/require] command to include the Cumulus web tags into your PHP file. (If you choose a template that includes function definitions as some of them do to permit you to list the source; then you must use '''include_once 'filename';''' or ''require_once 'filename';'').  Then where you would insert a web tag if you were writing a template, you insert a command to "echo" the php variable <pre><?=$PHP_variable_name[any_index_needed];?></pre>


The "=" in the above example is shorthand for " echo " with the spacing shown. In most of the ready made files listed for download on this page the PHP variable names are either identical to their [[webtags]] equivalent or have a name that reflects the output parameters selected, but of course if you are editing the file you might choose different names. For example in provided code, the Cumulus webtag <tt><#forecast></tt> would be referred to as <tt>$forecast</tt> in your PHP file.
The "=" in the above example is shorthand for " echo " with the spacing shown. In most of the ready made files listed for download on this page the PHP variable names are either identical to their [[webtags]] equivalent or have a name that reflects the output parameters selected, but of course if you are editing the file you might choose different names. For example in provided code, the Cumulus webtag <tt><#forecast></tt> would be referred to as <tt>$forecast</tt> in your PHP file.
5,838

edits