weather->forecast_information->city['data']; $temp_c= $xml_string->weather->current_conditions->temp_c['data']; $icon= $xml_string->weather->current_conditions->icon['data']; $condition= $xml_string->weather->current_conditions->condition['data']; #Vorschau $arr_day_of_week[] = array(); $arr_conditions[] = array(); $arr_icons[] = array(); $ctr=1; foreach($xml_string->weather->forecast_conditions as $elements) { array_push($arr_day_of_week,$elements->day_of_week['data']); array_push($arr_conditions,$elements->condition['data']); array_push($arr_icons,$elements->icon['data']); $ctr++; }//each $v++; if ($v >$ctr) ; if ($v <$ctr && $v >0) $ctr = $v; #---ausgabe--- #heute echo "

$stadt

"; #echo "$condition

$temp_c°C"; $img =''.$condition.''; echo "
$condition
$temp_c°C
$img "; #vorschau if($ctr>1) echo "

VORSCHAU

"; echo ""; for ($i=1;$i<$ctr;$i++) { echo "\n"; }//for echo "\n"; for ($i=1;$i<$ctr;$i++) { $icon= $arr_icons[$i]; echo''."\n"; }//for echo "
".$arr_day_of_week[$i]."
'.$condition.'
\n"; #---ausgabe--- }//getWeather function schmie_wetter_init() { // Ueberorueftt Wordpress-Funktion, Abbruch wenn nicht vorhanden if ( !function_exists('wp_register_sidebar_widget') ) return; // Ausgabe Frontend function schmie_wetter($args) { extract($args); // Auslesen der Optionen $options = get_option('schmie_wetter'); $titel = htmlspecialchars($options['titel'], ENT_QUOTES); $plz=htmlspecialchars($options['plz'], ENT_QUOTES); $vorschau=htmlspecialchars($options['vorschau'], ENT_QUOTES); // Ausgabe des Widgets echo $before_widget . $before_titel; echo "

$titel

"; getWetter($plz,$vorschau); echo $after_widget; } // back end controller function schmie_wetter_control() { // Auslesen der Optionen $options = get_option('schmie_wetter'); // Wenn Optionen nicht angegeben, Default-Werte setzen if ( empty($options) ) { $options = array('titel'=>'WetterWetter', 'plz'=>'66679', 'vorschau'=>'4' ); } if ( $_POST['schmie_wetter-submit'] ) { $options['titel'] = strip_tags(stripslashes($_POST['schmie_wetter-titel'])); $options['plz'] = strip_tags(stripslashes($_POST['schmie_wetter-plz'])); $options['vorschau'] = strip_tags(stripslashes($_POST['schmie_wetter-vorschau'])); update_option('schmie_wetter', $options); } $titel = htmlspecialchars($options['titel'], ENT_QUOTES); $vorschau = htmlspecialchars($options['vorschau'], ENT_QUOTES); $plz = htmlspecialchars($options['plz'], ENT_QUOTES); echo '

'; echo '

'; echo '

'; echo ' '; } wp_register_sidebar_widget('schmie_wetter', 'schmie_Wetter', 'schmie_wetter', array( 'classname' => 'schmie_wetter', 'description' =>'Zeigt das Wetter in deutschen Staedten nach Postleitzahl an.' ) ); wp_register_widget_control('schmie_wetter', 'On Last FM', 'schmie_wetter_control', array( 'width' => 300 ) ); } add_action('widgets_init', 'schmie_wetter_init'); ?>