Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Break in Cookie Crumbs

Quote Reply
Break in Cookie Crumbs
I have some of my sub categories named with a break in them. I used the tag <br> to make the name break like so:


my problem is now the cookie crumb breaks too like so:

should i not use the <br> tag, is there another way to make it break in the title without the cookie breaking too?
Quote Reply
Re: [tkporcel] Break in Cookie Crumbs In reply to
You could always override the format_title code to remove the <br>'s from the category names. Take a look at Links::Utils::format_title.

Adrian
Quote Reply
Re: [brewt] Break in Cookie Crumbs In reply to
where is that found at?
Quote Reply
Re: [tkporcel] Break in Cookie Crumbs In reply to
admin/Links/Utils.pm and look for the sub format_title. The header of that function describes the arguments that you can pass into it and how to override it.

Adrian
Quote Reply
Re: [brewt] Break in Cookie Crumbs In reply to
So in my utils.pm file what would I have to change here to make that not break?

sub format_title {
# -------------------------------------------------------------------
# Format a title
#
# Options:
# separator (required)
# The separator used to join the items.
# no_escape_separator
# Set this to a true value if you do not wish to HTML escape the separator.
# include_home
# Whether or not to include Home as the first entry. Default is no.
# link_type
# How the items should be linked:
# 0: No items linked
# 1: All items linked separately
# 2: All except the last item linked separately
# 3: All items linked as one single link (using the last item's URL)
# no_span
# Don't add the span tags around the last portion of the title. Default is to include the span tags.
#
# Note: You can override this function by creating a format_title_override global
#
my ($title_loop, %options) = @_;
return unless $title_loop;
my %vars = %{GT::Template->vars};
if (exists $vars{format_title_override}) {
return $vars{format_title_override}->(@_);
}
my $ret;
$options{separator} = GT::CGI::html_escape($options{separator}) unless $options{no_escape_separator};
for (0 .. $#$title_loop) {
next unless $_ or $options{include_home};
$ret .= '<span class="lasttitle">' if $_ == $#$title_loop and not $options{no_span};
if ($options{link_type} == 1 or
($options{link_type} == 2 and $_ != $#$title_loop)) {
$ret .= qq|<a href="$title_loop->[$_]->{URL}">$title_loop->[$_]->{Name}</a>|;
}
else {
$ret .= $title_loop->[$_]->{Name};
}
$ret .= $options{separator} unless $_ == $#$title_loop;
$ret .= '</span>' if $_ == $#$title_loop and not $options{no_span};
}
if ($options{link_type} == 3) {
$ret = qq|<a href="$title_loop->[-1]->{URL}">$ret</a>|;
}
return \$ret;
}
sub column_split {
Quote Reply
Re: [tkporcel] Break in Cookie Crumbs In reply to
Actually, looking at this again, an easier way than overriding the format_title method is to write a global which takes the title_loop and strips out the <br> before it gets passed into format_title(). However, it does mean you have to insert the call into all the templates.

Adrian
Quote Reply
Re: [brewt] Break in Cookie Crumbs In reply to
thanks for the reply, can someone walk me through this I have no clue as to how this is done.

-thanks
Quote Reply
Re: [tkporcel] Break in Cookie Crumbs In reply to
ok I fixed it I just added another category field for the second line. Real easy fix for anyone else that has this issue.

-Thanks