5,838
edits
m (→Using PHP scripts not processed by Cumulus: replace 'as above' by 'normal') |
m (→An example of a Cumulus template using PHP: added a little explanation of code) |
||
<tr>
<th title="Darkness times calculated by PHP">Darkness starts</th>
<td><?
</tr><tr>
<th>Darkness ends</th>
<td><?
</tr>
</pre>
This example shows that PHP instructions can be inserted into a normal HTML page simply by preceding the PHP instructions by the tag <?php, you then return to HTML using the tag ?>. All PHP instructions end in a semicolon (;) and to concatenate two strings you use full stop (.) so to concatenate something extra to an existing string you use full stop equals (.=). If the instruction is simply to place the contents of a PHP variable into HTML, the standard is to precede the PHP variable by <?=. Normally, PHP variables use names that start with dollar sign ($). Comments may be inserted into PHP code in several ways, but double slash (//) is used for annotations where you want the instruction before to be processed, but then the PHP parser should ignore everything after the double slash in the same line.
Incidentally, do look at the Cumulus FAQ or [[Webtags#Day.2FNight.2FSun.2FMoon|web tags]] where what Cumulus reports as Sunrise time is explained as the last one before any midnight GMT, and what it reports as Sunset time refers to that occurring after the midnight GMT, so they are frequently on different days.
|
edits