Benutzer:Erik/Extension:Häfen in der Nähe: Unterschied zwischen den Versionen
Erik (Diskussion | Beiträge) K Revisionsliste + ToDo-Liste |
Erik (Diskussion | Beiträge) →Installation: showdist Attribut zur konfiguartion der Anzeige der Distanz (An/Aus) hinzu gefügt |
||
| Zeile 46: | Zeile 46: | ||
// HISTORY | // HISTORY | ||
// 2007-03-04 : The display of the distance is no deactivated by default. | |||
// It can be activated using the showdist attribute. | |||
// 2007-03-04 : Fix for PHP 4 | // 2007-03-04 : Fix for PHP 4 | ||
// Instead of DOM or DOM XML, the xml parser functions are used | // Instead of DOM or DOM XML, the xml parser functions are used | ||
| Zeile 201: | Zeile 203: | ||
$max_cnt = 10; | $max_cnt = 10; | ||
} | } | ||
$show_distance = false; | |||
if (isset($argv["showdist"])) { | |||
if ($argv["showdist"] == "yes") { | |||
$show_distance = true; | |||
} | |||
} | |||
// initialize the array for the found places | // initialize the array for the found places | ||
$nearby_places = array(); | $nearby_places = array(); | ||
| Zeile 274: | Zeile 283: | ||
foreach ($nearby_places as $place) { | foreach ($nearby_places as $place) { | ||
$output .= "[[" . $place["link"] . "|" . $place["name"] . "]]"; | |||
if ($show_distance == true) { | |||
$output .= " (" . number_format($place["dist"], 0) . "sm)"; | |||
} | |||
$output .= " |\n"; | |||
$cnt++; | $cnt++; | ||
if ($cnt >= $max_cnt) { | if ($cnt >= $max_cnt) { | ||