--- branches/tehnika/WebPac.pm 2004/03/12 15:33:13 264 +++ branches/tehnika/WebPac.pm 2004/04/04 22:11:13 303 @@ -43,7 +43,7 @@ sub url_ex { my $q = shift || die "suff2file needs CGI object!"; my $tpl = shift || die "url_ex needs template name!"; - return suff2file($BASE_PATH, $q->url(-path => 1),$TEMPLATE_PATH,$tpl); + return suff2file($BASE_PATH, $q->url(-absolute => 1,-path => 1),$TEMPLATE_PATH,$tpl); } sub suff2file($$$$) { @@ -53,7 +53,11 @@ # strip everything to and including base path, leaving only # additional (virtual) path - if ($p =~ s,^.*?$base_path,,) { + if ($base_path eq "/") { + $p =~ s,/*,,g; + my ($name,$ext) = split(/\./,$tpl); + $p = $name . "-" . $p . "." . $ext; + } elsif ($p =~ s,^.*?$base_path,,) { $p =~ s,/*,,g; my ($name,$ext) = split(/\./,$tpl); $p = $name . $p . "." . $ext; @@ -97,7 +101,7 @@ die "can't parse TEMPLATE path"; } - my $master_tpl = suff2file($BASE_PATH, $q->url(-path => 1),$dir,$tpl); + my $master_tpl = suff2file($BASE_PATH, $q->url(-absolute => 1, -path => 1),$dir,$tpl); if (open(T, $master_tpl)) { my $template_html = join("\n",); close(T);