hallo mawenzi,
ja, das schaut soweit schon mal sehr gut bei dir in deinem beispiel aus... wenn das jetzt automatisch tagesaktualisiert wäre, wäre das perfekt...
der ansatz über google ist glaube ich richtig, da hier ja über lat. und long. das wetter ausgegeben werden kann. zudem ist es international. in zusammenarbeit mit alekinna (vielen dank hierfür) habe ich eine lösung für deutschland auf basis der PLZ realisieren können - hier der code falls das für euch von interesse ist...
1. in the file lang/your_lang/main.php
add
$lang['weather'] = "Weather";
$lang['weather_format_desc'] = "Insert Zip code. For example:<br />for Erlangen type <b>91054</b>";
$lang['weather_format_error'] = "Incorrect format for field \"weather\"";
2. in the file member.php
find
"max_media_imageheight" => $config['max_image_height']." ".$lang['px'],
add below
"lang_weather_format_desc" => $lang['weather_format_desc'],
2.1 find this code after if ($action == "uploadimage") {
if (!empty($additional_image_fields)) {
foreach ($additional_image_fields as $key => $val) {
if (isset($HTTP_POST_VARS[$key]) && intval($val[2]) == 1 && trim($HTTP_POST_VARS[$key]) == "") {
$error = 1;
$field_error = preg_replace("/".$site_template->start."field_name".$site_template->end."/siU", str_replace(":", "", $val[0]), $lang['field_required']);
$msg .= (($msg != "") ? "<br />" : "").$field_error;
}
}
}
replace with
if (!empty($additional_image_fields)) {
foreach ($additional_image_fields as $key => $val) {
if (isset($HTTP_POST_VARS[$key]) && intval($val[2]) == 1 && trim($HTTP_POST_VARS[$key]) == "") {
$error = 1;
$field_error = preg_replace("/".$site_template->start."field_name".$site_template->end."/siU", str_replace(":", "", $val[0]), $lang['field_required']);
$msg .= (($msg != "") ? "<br />" : "").$field_error;
}
elseif ($key == "weather") {
if (isset($HTTP_POST_VARS[$key]) && trim($HTTP_POST_VARS[$key]) != "") {
if (!ctype_digit($HTTP_POST_VARS[$key])){
$error = 1;
$msg .= (($msg != "") ? "<br />" : "").$lang['weather_format_error'];
}
}
}
if field for zip not empty, this code will check if user inserted in only digits and not letters. But it not check count of digits, because I don't know if it may has only 5 digits or more (or less) too.
So just tell me if zip code may has letters and how many charts.
3. in the file member_uploadform.html
use for example
<tr>
<td class="row2" valign="top"><b>{lang_weather}</b><br />{lang_weather_format_desc}</td>
<td class="row2"><input type="text" name="weather" size="30" value="{weather}" class="input" /></td>
</tr>
4. in the file details.html
use
<script src="http://www.weather-world.de/xml/hp3.php?id={weather}&design=1" language="JavaScript"></script>
<noscript><a href="http://www.weather-world.de">Wetter</a></noscript>
5. in the file includes/db_field_definitions.php
add
$additional_image_fields['weather'] = array($lang['weather'], "text", 0);
6. new value in DB
do changes if need and use the code below
varchar(10) - zip code may be up to 10 charts
DEFAULT '91054' - default value for all images, when user insert his zip, it will be overwrite with new value
ALTER TABLE `4images_images` ADD `weather` varchar(10) NOT NULL DEFAULT '91054'
aber wie gesagt... international auf basis von latitude und longitude wäre das der oberhammer...
gruss,
bergblume