Exemplo n.º 1
0
<?php

require_once 'WeatherForecast.php';
require_once 'WeatherDayInfo.php';
$url = "http://jornaldotempo.uol.com.br/rss/cidades/rss_prev_Lavras-MG.xml";
$reader = new RSSReader(simplexml_load_file($url));
$rssItem = $reader->getRssWeahter();
$wheaterForecast = new WeatherForecast($rssItem->title(), $rssItem->description());
$daysInfo = $wheaterForecast->daysInfo();
?>
<div id="weatherforecast">
    <label for="weather-city" style="color: #921b1b; font-weight: bold;">
        Para trocar a cidade clique na caixa abaixo
    </label><br />
    <h2>
        <!--<span><?echo $wheaterForecast->city()?></span>-->
        <?include "cities.html"?>
    </h2>
    <div class="painel-weather">
        <table class="weather-table" border="0">
            <tbody>
            <?$i = 0;?>
            <?while($daysInfo->valid() && $i < 4):?>
              <?$dayInfo = $daysInfo->current();?>
              <?if($i % 2 == 0):?>
              <tr>
              <?endif?>
                  <td>
                      <div class="td-weather">
                        <?echo $dayInfo->day()?> <!--(<?//echo $dayInfo->situation()?>)--> <br/>
                        <div class="weather-info">
Exemplo n.º 2
0
 /**
  * Defines the name of the city
  * 
  * @param string $city City name
  */
 private static function setCity($city)
 {
     self::$city = (string) self::slug($city);
 }