Here's the other changes...
sub build_linked_title {
# --------------------------------------------------------
# Returns a string of the current category broken up
# by section, with each part linked to the respective section.
my $input = shift;
my (@dirs, $dir, $output, $path, $last, $dir_2);
my $suffix = '_directory';
@dirs = split (/\//, $input);
my $quant = @dirs;
$last = &build_clean(pop @dirs);
if ($quant > 1) {
$last = $last . $suffix;
}
$first = $dirs[0];
foreach $dir(@dirs) {
$dir = $dir . $suffix;
}
$dirs[0] = $first;
$output = qq| <A HREF="$build_root_url/">Top</A> :|;
foreach $dir (@dirs) {
$path .= "/$dir";
$path =~ tr/[A-Z]/[a-z]/;
$dir =~ s/$suffix//g;
$dir = &build_clean ($dir);
$output .= qq| <A HREF="$build_root_url$path/">$dir</A> :|;
}
$output .= " $last";
return $output;
}
sub urlencode {
# --------------------------------------------------------
# Escapes a string to make it suitable for printing as a URL.
#
my($toencode) = shift;
my $suffix = '_directory';
$toencode =~ s/([^a-zA-Z0-9_\-.])/uc sprintf("%%%02x",ord($1))/eg;
$toencode =~ s/\%2F/\//g; # replaces a / for a space
$toencode =~ tr/[A-Z]/[a-z]/;
if ($toencode =~ /\/+/) {
$toencode = $toencode . $suffix;
}
return $toencode;
}
Leonard
aka PerlFlunkie
Code:
sub build_linked_title {
# --------------------------------------------------------
# Returns a string of the current category broken up
# by section, with each part linked to the respective section.
my $input = shift;
my (@dirs, $dir, $output, $path, $last, $dir_2);
my $suffix = '_directory';
@dirs = split (/\//, $input);
my $quant = @dirs;
$last = &build_clean(pop @dirs);
if ($quant > 1) {
$last = $last . $suffix;
}
$first = $dirs[0];
foreach $dir(@dirs) {
$dir = $dir . $suffix;
}
$dirs[0] = $first;
$output = qq| <A HREF="$build_root_url/">Top</A> :|;
foreach $dir (@dirs) {
$path .= "/$dir";
$path =~ tr/[A-Z]/[a-z]/;
$dir =~ s/$suffix//g;
$dir = &build_clean ($dir);
$output .= qq| <A HREF="$build_root_url$path/">$dir</A> :|;
}
$output .= " $last";
return $output;
}
Code:
sub urlencode {
# --------------------------------------------------------
# Escapes a string to make it suitable for printing as a URL.
#
my($toencode) = shift;
my $suffix = '_directory';
$toencode =~ s/([^a-zA-Z0-9_\-.])/uc sprintf("%%%02x",ord($1))/eg;
$toencode =~ s/\%2F/\//g; # replaces a / for a space
$toencode =~ tr/[A-Z]/[a-z]/;
if ($toencode =~ /\/+/) {
$toencode = $toencode . $suffix;
}
return $toencode;
}
Leonard
aka PerlFlunkie