yr-forecast-page.tpl.php in Yr Weatherdata 6
yr-forecast-page.tpl.php Default theme implementation to display a full-page forecast for a given location.
Available variables:
- $name: The name of the location. Not used here, but available for custom theming.
- $info: Basic information about this location.
- $links: Links to more forecast and information about this location.
- $sun: Sunrise and sunset.
- $text_forecast: Array where each element is an array with 'title' and 'body'. Textual forecast for upcoming periods.
- $symbol_forecast: Array where each element is an array with processed data from the xml from yr.no. Detailed graphical forecast for upcoming periods.
- $credit: Link to http://yr.no
$symbol_forecast elements: # open: An opening <div>, if needed, to separate between days. # close: The closing of 'open', if needed. # class: Class name for the period-box. # time: The time of day, given in 24H format, like '14-20'. # symbol: Complete <img /> tag. # wind:
- ['wind']['speed'] => array('name', 'mps')
- ['wind']['dir'] => array('deg', 'name', 'code')
- ['wind']['img'] => Complete <img /> tag.
# precip: Precipitation in millimeter. Float value. # temp:
- ['val'] => Temperature with degree notation and unit (F or C).
- ['class'] => 'plus' or 'minus', to style the temperature display based on wether it's freezing or not.
# pressure: Pressure in hPa. Including notation. # radar:
- ['text'] => The name of the radarsite.
- ['image'] => A radar image of 460px width, linked to the radarsite-page for the location on yr.no.
File
yr-forecast-page.tpl.phpView source
<?php
/**
* @file yr-forecast-page.tpl.php
* Default theme implementation to display a full-page forecast for a given location.
*
* Available variables:
* - $name: The name of the location. Not used here, but available for custom theming.
* - $info: Basic information about this location.
* - $links: Links to more forecast and information about this location.
* - $sun: Sunrise and sunset.
* - $text_forecast: Array where each element is an array with 'title' and 'body'.
* Textual forecast for upcoming periods.
* - $symbol_forecast: Array where each element is an array with processed data from
* the xml from yr.no.
* Detailed graphical forecast for upcoming periods.
* - $credit: Link to http://yr.no
*
* $symbol_forecast elements:
* # open: An opening <div>, if needed, to separate between days.
* # close: The closing of 'open', if needed.
* # class: Class name for the period-box.
* # time: The time of day, given in 24H format, like '14-20'.
* # symbol: Complete <img /> tag.
* # wind:
* - ['wind']['speed'] => array('name', 'mps')
* - ['wind']['dir'] => array('deg', 'name', 'code')
* - ['wind']['img'] => Complete <img /> tag.
* # precip: Precipitation in millimeter. Float value.
* # temp:
* - ['val'] => Temperature with degree notation and unit (F or C).
* - ['class'] => 'plus' or 'minus', to style the temperature display based on wether it's freezing or not.
* # pressure: Pressure in hPa. Including notation.
* # radar:
* - ['text'] => The name of the radarsite.
* - ['image'] => A radar image of 460px width, linked to the radarsite-page for the location on yr.no.
*/
?>
<div id="yr-forecast-page">
<ul id="yr-forecast-tabs-links">
<li><a href="#yr-location-info" title="<?php
print $tabs[0];
?>"><?php
print $tabs[0];
?></a></li>
<?php
if (!empty($text_forecast)) {
?>
<li><a href="#yr-text-forecast" title="<?php
print $tabs[1];
?>"><?php
print $tabs[1];
?></a></li>
<?php
}
?>
<li><a href="#yr-symbol-forecast" title="<?php
print $tabs[2];
?>"><?php
print $tabs[2];
?></a></li>
<?php
if (!empty($radar['image'])) {
?>
<li><a href="#yr-medium-radar" title="<?php
print $tabs[3];
?>"><?php
print $tabs[3];
?></a></li>
<?php
}
?>
</ul>
<div id="yr-location-info">
<p class="yr-info-text"><?php
print $info;
?></p>
<p class="yr-sun"><?php
print $sun;
?></p>
<div class="yr-location-links"><?php
print $links;
?></div>
<div class="yr-upcoming-periods clear-block">
<?php
$i = 0;
while ($i < 4) {
?>
<div class="yr-upcoming-period-box <?php
print $symbol_forecast[$i]['class'];
?>">
<p><?php
print $symbol_forecast[$i]['time'];
?></p>
<p><span class="yr-symbol"><?php
print $symbol_forecast[$i]['symbol'];
?></span>
<span class="yr-temp <?php
print $symbol_forecast[$i]['temp']['class'];
?>"><?php
print $symbol_forecast[$i]['temp']['val'];
?></span>
<span class="yr-wind"><?php
print $symbol_forecast[$i]['wind']['img'];
?></span></p>
<p class="yr-precip"><?php
print $symbol_forecast[$i]['precip'];
?></p>
<p class="yr-pressure"><?php
print $symbol_forecast[$i]['pressure'];
?></p>
</div>
<?php
$i++;
}
?>
</div>
</div>
<div id="yr-text-forecast">
<?php
foreach ($text_forecast as $forecast) {
?>
<h4><?php
print $forecast['title'];
?></h4>
<p><?php
print $forecast['body'];
?></p>
<?php
}
?>
</div>
<div id="yr-symbol-forecast" class="clear-block">
<?php
foreach ($symbol_forecast as $item) {
?>
<?php
print $item['open'];
?>
<div class="yr-period-box <?php
print $item['class'];
?>">
<p><?php
print $item['time'];
?></p>
<p><span class="yr-symbol"><?php
print $item['symbol'];
?></span>
<span class="yr-temp <?php
print $item['temp']['class'];
?>"><?php
print $item['temp']['val'];
?></span>
<span class="yr-wind"><?php
print $item['wind']['img'];
?></span></p>
<p class="yr-precip"><?php
print $item['precip'];
?></p>
<p class="yr-pressure"><?php
print $item['pressure'];
?></p>
</div>
<?php
print $item['close'];
?>
<?php
}
?>
</div>
<div id="yr-medium-radar">
<h4><?php
print $radar['text'];
?></h4>
<p><?php
print $radar['image'];
?></p>
</div>
</div>
<div class="yr-credit"><p><?php
print $credit;
?></p></div>