Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Bug? In build_title_linked

Quote Reply
Bug? In build_title_linked
There is a kind of problem in build_title_linked and (build.pm) whereby if there is a "/" [forward slash] in the title, then LSQL will assume that the section that comes before the slash constitutes a category, and as such will build an extra level for it, as such:

Category Name: Top/Semantics/Pronouns
Link Title: The strange seemed to have issues with his/her appearance

Subsequent title_linked result:

Top/Semantics/Pronouns/The_strange_seemed_to have_issues_with_his/her_appearance

In HTML:

Code:
<a href=/>Top</a> : <a href=/semantics/>Semantics</a> : <a href=/semantics/pronouns/>Pronouns</a> : <a href=The_strange_seemed_to have_issues_with_his/her_appearance>The_strange_seemed_to have_issues_with_his/her_appearance</a>

LSQL will create a link to the category "The_strange_seemed_to have_issues_with_his" which doesn't exist. The title needs to be passed in separately and added at the end.

Same problem also occurs in build_title_unlinked, to a lesser degree.

Code:
sub build_title_linked {
# ------------------------------------------------------------------
# Generate a linked title.
#
my $input = shift;
my $complete = 0;
my $home = 1;
if (ref $input) {
$complete = $input->{complete} || 0;
$home = defined $input->{home} ? $input->{home} : 1;
$input = $input->{name};
}
my (@dirs, $dir, $output, $path, $last, $db, $top);

$db = $DB->table('Category');
$top = Links::language('LINKS_TOP') || 'Top';

@dirs = split (/\//, $input);
$last = pop @dirs unless ($complete);
$output = $home ? qq| <a href="$CFG->{build_root_url}/$CFG->{build_index}">$top</a> :| : '';
for (0 .. $#dirs) {
$path = "/" . $db->as_url ( join "/", @dirs[0 .. $_] );
$output .= qq| <a href="$CFG->{build_root_url}$path/$CFG->{build_index}">$dirs[$_]</a> :|;
}
if ($complete) {
chop $output; chop $output;
}
else {
$output .= " $last";
}
return $output;
}
END_OF_SUB
Subject Author Views Date
Thread Bug? In build_title_linked cwi 1358 Feb 11, 2003, 3:55 PM
Thread Re: [cwi] Bug? In build_title_linked
yogi 1312 Feb 12, 2003, 12:27 AM
Post Re: [yogi] Bug? In build_title_linked
Paul 1326 Feb 12, 2003, 2:09 AM
Post Re: [cwi] Bug? In build_title_linked
pugdog 1300 Feb 12, 2003, 7:07 AM