--- trunk/WebPac.pm 2003/12/21 06:35:43 198 +++ trunk/WebPac.pm 2004/04/04 22:09:57 302 @@ -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); @@ -221,6 +225,12 @@ return $html; } + my $sort = 'swishrank'; + if ($q->param("sort")) { + $sort = 'headline'; + push @persist_vars, "sort"; + } + # call swish my $sh = SWISH->connect('Fork', prog => $SWISH, @@ -238,7 +248,8 @@ }, #startnum => 0, - maxhits => $MAX_HITS + maxhits => $MAX_HITS, + sortorder => $sort, ); die $SWISH::errstr unless $sh;