diff options
author | Luke Bratch <luke@bratch.co.uk> | 2021-12-07 09:54:55 +0000 |
---|---|---|
committer | Luke Bratch <luke@bratch.co.uk> | 2021-12-07 09:54:55 +0000 |
commit | 04eecafe7d7e208a5b93cb4fac48fb61e7ea1bb8 (patch) | |
tree | 78aa46316f1dbc24a88434d1a7a9656131578f8e /index.php | |
parent | 8cedbdd893c88e0fec75f6694752791e3994bcba (diff) |
Add wind force value to title and summary lines (in day mode).
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -25,6 +25,7 @@ $nightmode = 0; $valid = array(); $temp = array(); $misc = array(); +$wind = array(); foreach ($divs as $div) { if ($day > 2) { @@ -59,6 +60,14 @@ foreach ($divs as $div) { } } } + + if ($attr->nodeValue == "wind") { + $spans = $div->getElementsByTagName("span"); + foreach ($spans as $span) { + array_push($wind, $span->nodeValue); + } + } + } } @@ -74,7 +83,7 @@ for ($i = 0; $i < count($temp); $i++) { } if (!$nightmode) { - echo "<title>Max $temp[0], Min $temp[1], Cur $temp[2], $misc[0]</title>\n\n"; + echo "<title>Max $temp[0], Min $temp[1], Cur $temp[2], Wind $wind[0], $misc[0]</title>\n\n"; } else { echo "<title>Min $temp[0], Cur $temp[1], $misc[0]</title>\n\n"; } @@ -86,7 +95,7 @@ echo "<p>Forecasts | <a href=\"./graphs.php\">Graphs</a></p>\n\n"; echo "<h2>Today</h2>\n\n"; echo "<p><em>$valid[0]</em><br><br>\n"; if (!$nightmode) { - echo "<strong>Max:</strong> $temp[0], <strong>Min:</strong> $temp[1], <strong>Current</strong>: $temp[2]<br><br>\n"; + echo "<strong>Max:</strong> $temp[0], <strong>Min:</strong> $temp[1], <strong>Current</strong>: $temp[2], <strong>Wind</strong>: $wind[0]<br><br>\n"; } else { echo "<strong>Min:</strong> $temp[0], <strong>Cur:</strong> $temp[1]<br><br>\n"; } @@ -96,7 +105,7 @@ echo "<strong>Wind:</strong> $misc[1]<br><br>\n"; echo "<h2>Tomorrow</h2>\n\n"; echo "<p><em>$valid[1]</em><br><br>\n"; if (!$nightmode) { - echo "<strong>Max</strong>: $temp[3], <strong>Min</strong>: $temp[4]<br><br>\n"; + echo "<strong>Max</strong>: $temp[3], <strong>Min</strong>: $temp[4], <strong>Wind</strong>: $wind[2]<br><br>\n"; } else { echo "<strong>Max</strong>: $temp[2], <strong>Min</strong>: $temp[3]<br><br>\n"; } |