diff --git a/htdocs/templates2/ocstyle/viewcache.tpl b/htdocs/templates2/ocstyle/viewcache.tpl index 56f58f83..551e3bee 100644 --- a/htdocs/templates2/ocstyle/viewcache.tpl +++ b/htdocs/templates2/ocstyle/viewcache.tpl @@ -185,7 +185,7 @@  {t}Time required{/t}: {$cache.searchtime|format_hour} h {/if} {if $cache.waylength>0} -  {t}Waylength{/t}: {$cache.waylength|sprintf:'%01.2f'} km +  {t}Waylength{/t}: {$cache.waylength} km {/if} {if $cache.searchtime>0 || $cache.waylength>0}
{/if}  {if $cache.type==6}{t}Event date{/t}{else}{t}Hidden at{/t}{/if}: {$cache.datehidden|date_format:$opt.format.datelong}
diff --git a/htdocs/templates2/ocstyle/viewcache_print.tpl b/htdocs/templates2/ocstyle/viewcache_print.tpl index acc0711e..e8fbf418 100644 --- a/htdocs/templates2/ocstyle/viewcache_print.tpl +++ b/htdocs/templates2/ocstyle/viewcache_print.tpl @@ -84,7 +84,7 @@ {t}Time required{/t}: {$cache.searchtime|format_hour} h {/if} {if $cache.waylength>0} - {t}Distance{/t}: {$cache.waylength|sprintf:'%01.2f'} km + {t}Distance{/t}: {$cache.waylength} km {/if} {if $cache.searchtime>0 || $cache.waylength>0}
{/if} {if $cache.status!=1} diff --git a/htdocs/viewcache.php b/htdocs/viewcache.php index fa61d63b..76aa0770 100644 --- a/htdocs/viewcache.php +++ b/htdocs/viewcache.php @@ -146,6 +146,21 @@ function getChildWaypoints($cacheid) if ($rCache === false) $tpl->error(ERROR_CACHE_NOT_EXISTS); + // format waylength + if ($rCache['waylength'] < 5) + if (round($rCache['waylength'],2) != round($rCache['waylength'],1)) + $digits = 2; + else + $digits = 1; + else if ($rCache['waylength'] < 50) + if (round($rCache['waylength'],1) != round($rCache['waylength'],0)) + $digits = 1; + else + $digits = 0; + else + $digits = 0; + $rCache['waylength'] = sprintf('%.'.$digits.'f', $rCache['waylength']); + // not published? if ($rCache['status'] == 5) {