Gossamer Forum
Home : Products : Gossamer Links : Discussions :

suggestion: html_escape build_title_linked

Quote Reply
suggestion: html_escape build_title_linked
Hi,

I just stepped over one thing I wanted to have - probably there are more cases like that - where html_escaping would be nice.
In Build.pm :

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 $db = $DB->table('Category');
my $top = Links::language('LINKS_TOP');

my @dirs = split /\//, $input;
my $last;
$last = pop @dirs unless $complete;

my @paths;
push @paths, qq{<a href="$CFG->{build_root_url}/} . ($CFG->{build_home} || ($CFG->{build_index_include} ? $CFG->{build_index} : '')) . qq{">$top</a>} if $home;
for (0 .. $#dirs) {
my $path = "/" . $db->as_url(join "/", @dirs[0 .. $_]);
#old push @paths, qq{<a href="$CFG->{build_root_url}$path/} . ($CFG->{build_index_include} ? $CFG->{build_index} : '') . qq{">$dirs[$_]</a>};
push @paths, qq{<a href="$CFG->{build_root_url}$path/} . ($CFG->{build_index_include} ? $CFG->{build_index} : '') . qq{">} . GT::CGI->html_escape($dirs[$_]) . qq{</a>};
}
push @paths, $last unless $complete;
return join ': ', @paths;
}
END_OF_SUB
pros and cons are welcome

Regards

n||i||k||o
Quote Reply
Re: [el noe] suggestion: html_escape build_title_linked In reply to
It will be left as is for backwards compatibility, but the preferred way to do this with glinks 3.x would be to use build_title() and the title_loop array instead. A little more template code, but would allow you more control over the output.

Adrian
Quote Reply
Re: [brewt] suggestion: html_escape build_title_linked In reply to
Hi Adrian,

thank you for your comment. Makes sense.
I am using title_loop for the detailed pages already to show all Categories but didnĀ“t think about using it for Category pages.

Regards

n||i||k||o

Last edited by:

el noe: Jan 6, 2011, 5:56 AM