Gossamer Forum
Home : Products : Gossamer Links : Discussions :

class="lasttitle" in crumbs

Quote Reply
class="lasttitle" in crumbs
Why is <span class="lasttitle">Current category</span> hardcoded into the crumbs?


luna_core.css and luna.css doesn't even contain lasttitle Crazy



I tried to use the following code

<%Links::Utils::format_title($title_loop, separator => $category_separator, no_escape_separator => $no_escape_category_separator, include_home => 1, link_type => 0)%>



on category.html template but it doesn't work because of

<span class="lasttitle">Current category</span>


Is there an easier way to achieve the same thing?

Thanks in advance!

Quote Reply
Re: [Payooo] class="lasttitle" in crumbs In reply to
The span shouldn't cause any problems. It's there so you can style the last part of the crumb if you wish. How is it causing problems for you?

Adrian
Quote Reply
Re: [brewt] class="lasttitle" in crumbs In reply to
I would like to place

<%Links::Utils::format_title($title_loop, separator => $category_separator, no_escape_separator => $no_escape_category_separator, include_home => 1, link_type => 0)%>

in <title>...</title> tag into the category.html template to achieve the same result like crumbs, but not linked.

+

I would like to use
'category_separator'.


Currently, the result is:

<title>MYDIR.EXT - Directory - Web Hosting - <span class="lasttitle">Dedicated Hosting</span></title>

<span class="lasttitle"></span> is not very welcome in title tag.

Is there a way to achieve the same thing using another method?




By the way, how can we use
category_separator?

Also, where can we find info on the top of templates like on older versions?

Example:

<%--
File : detailed.html
Description : This file displays a link as a single page.
Tags : You have all the properties of a link available on this page, plus a few special ones:
title_linked => The title of the category linked
title => The title of the category unlinked
next => The ID number of the next link in the category
prev => The ID number of the previous link in the category
next_url => A link to the next link in the category
prev_url => A link to the previous url in the category
--%>


New templates doesn't contain such info.

Quote Reply
Re: [Payooo] class="lasttitle" in crumbs In reply to
It wasn't really designed to be used in there, but I guess it should be able to. I guess I need to add a no_span option to not add the span. Pretty easy to add, here's a patch to Links::Utils:
Code:
diff -u -r1.39 Utils.pm
--- Utils.pm 14 Apr 2005 07:48:46 -0000 1.39
+++ Utils.pm 27 Apr 2005 03:56:59 -0000
@@ -468,6 +468,8 @@
# 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
#
@@ -483,7 +485,7 @@
$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;
+ $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>|;
@@ -492,7 +494,7 @@
$ret .= $title_loop->[$_]->{Name};
}
$ret .= $options{separator} unless $_ == $#$title_loop;
- $ret .= '</span>' if $_ == $#$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>|;

If you look at the header of the format_title function, it will tell you what options are available and what they do. I'll probably write a howto about it one of these days, though most of the options are covered in the luna globals documentation.

Adrian
Quote Reply
Re: [brewt] class="lasttitle" in crumbs In reply to
Thank you for the fix, but I am not convinced that this is the best solution.

You already have

<div class="crumb"><%Links::Utils::format_title($title_loop, separator => $crumb_separator, no_escape_separator => $no_escape_crumb_separator, include_home => 1, link_type => 2)%></div>

in templates.

My 'opinion' is that it would be easier to just change

.crumb {
font-size: 9px;
}

to something like

.crumb {color: #999; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 9px; text-decoration: none; font-weight: bold;}
.crumb a:link,
.crumb a:visited,
.crumb a:active {color: #000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 9px; text-decoration: underline; font-weight: bold}
.crumb a:hover {color: #000; text-decoration: none;}


This will control the look and feel of linked categories + last unlinked category.



.crumb {color: #999; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 9px; text-decoration: none; font-weight: bold;}

part will also affect 'category_separator' but you can easily add the following code to style it (if you want)

<span class="crumbseparator"> > </span>

and in css file:

.
crumbseparator {color: #ccc; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 9px; text-decoration: none; font-weight: bold;}

or anything like ...

I must admit that I am not CSS expert but I think this might work (it is working on my site)


The main advantage is that HTML code is not hardcoded in Glinks.


Thanks for your help


Quote Reply
Re: [Payooo] class="lasttitle" in crumbs In reply to
For most situations, having the span will not cause any problems. Putting in the title is one of the few places it does cause a problem and having to pass in an extra option is imho acceptable.

Doing what you said is also an acceptable way of doing it, but we can't go changing things like this after it's been released, so it has to stay as is (which imho is fine as well).

Adrian