You are here

weather.html.twig in Weather 2.0.x

Same filename and directory in other branches
  1. 8 templates/weather.html.twig
<div class="weather">
  {% for place in weather %}
    <p style="clear:left"><strong>{{ place.link }}</strong></p>
    {% if place.forecasts is empty%}
      {{'Currently, there is no weather information available.'|t }}
    {% endif %}
    {% for forecast in place.forecasts %}
      {% for time_range, data in forecast.time_ranges %}
        <p style="clear:left">
          {{ forecast.formatted_date }}<br />
          {% if forecast.sun_info %}
            {% if forecast.sun_info is iterable %}
              {{ "Sunrise: @time"|t({'@time':  forecast.sun_info.sunrise}) }}<br />
              {{ "Sunset: @time"|t({'@time':  forecast.sun_info.sunset}) }}<br />
            {% else %}
              {{forecast.sun_info }}<br />
            {% endif %}
          {% endif %}
          {{ time_range }}
        </p>
        <div style="float:left;margin-right:1em;margin-bottom:1em">
          {{ data.symbol }}
        </div>
        <p style="font-size:125%">
          {{ data.condition }}<br />
          {{ data.temperature }}
          {% if data.windchill %}
            <br />
            {{ "Feels like !temperature"|t({'!temperature':  data.windchill}) }}
          {% endif %}
        </p>
      {% endfor %}
    {% endfor %}
    {% if place.station %}
      <p style="clear:left">
        {{ 'Location of this weather station:'|t }}<br />
        {{ place.station }}
      </p>
    {% endif %}
    <p style="clear:left">
      {{ '<a href="@url">Weather forecast from yr.no</a>, delivered by the Norwegian Meteorological Institute and the NRK'|t({'@url':  place["yr.no"]}) }}
    </p>
  {% endfor %}
</div>

File

templates/weather.html.twig
View source
  1. <div class="weather">
  2. {% for place in weather %}
  3. <p style="clear:left"><strong>{{ place.link }}</strong></p>
  4. {% if place.forecasts is empty%}
  5. {{'Currently, there is no weather information available.'|t }}
  6. {% endif %}
  7. {% for forecast in place.forecasts %}
  8. {% for time_range, data in forecast.time_ranges %}
  9. <p style="clear:left">
  10. {{ forecast.formatted_date }}<br />
  11. {% if forecast.sun_info %}
  12. {% if forecast.sun_info is iterable %}
  13. {{ "Sunrise: @time"|t({'@time': forecast.sun_info.sunrise}) }}<br />
  14. {{ "Sunset: @time"|t({'@time': forecast.sun_info.sunset}) }}<br />
  15. {% else %}
  16. {{forecast.sun_info }}<br />
  17. {% endif %}
  18. {% endif %}
  19. {{ time_range }}
  20. </p>
  21. <div style="float:left;margin-right:1em;margin-bottom:1em">
  22. {{ data.symbol }}
  23. </div>
  24. <p style="font-size:125%">
  25. {{ data.condition }}<br />
  26. {{ data.temperature }}
  27. {% if data.windchill %}
  28. <br />
  29. {{ "Feels like !temperature"|t({'!temperature': data.windchill}) }}
  30. {% endif %}
  31. </p>
  32. {% endfor %}
  33. {% endfor %}
  34. {% if place.station %}
  35. <p style="clear:left">
  36. {{ 'Location of this weather station:'|t }}<br />
  37. {{ place.station }}
  38. </p>
  39. {% endif %}
  40. <p style="clear:left">
  41. {{ '<a href="@url">Weather forecast from yr.no</a>, delivered by the Norwegian Meteorological Institute and the NRK'|t({'@url': place["yr.no"]}) }}
  42. </p>
  43. {% endfor %}
  44. </div>