Gossamer Forum
Home : Products : Links 2.0 : Customization :

this cannot be this difficult... adding title=description to menu mod

Quote Reply
this cannot be this difficult... adding title=description to menu mod
okay, normally i just wouldnt care but this has to be so stupid simple that i just cant let go... i have tried every different way of doing this so im sure its some coding thing i have to do that i am unaware of

in db_utils:

sub menu {
# --------------------------------------------------------
#
my (@subcat) = @_;
my (%c, @fields, $subcat, $description);
open (DB, "<$db_category_name") or &cgierr("unable to open $db_file_name. Reason: $!");
if ($db_use_flock) { flock(DB, 1); }
LINE: while (<DB>) {
(/^#/) and next LINE;
(/^\s*$/) and next LINE;
@fields = &split_decode ($_);
next LINE if (@fields[$db_main_category] =~ "LinkLists");
next LINE if (@fields[$db_main_category] =~ "menu");
$c{$fields[$db_main_category]}++;
}
close DB;
foreach $field (sort keys %c) {
($description) = @{$category{$subcat}}[2];
if ($field =~ m,^([^/]*)$,) {
$field2 = &build_clean($field);
$category_list .= qq|<a title="$description" href="$build_root_url/$field">$field2</a><br> \n|;
}
}
return $category_list;
}

the text in red is what i am working with. everything works fine but the title="$description" produces title="" in the return... what am i doing wrong!?!?!?

thanks in advance for any and all help Sly




Vote Stinky
Quote Reply
Re: [security_man] this cannot be this difficult... adding title=description to menu mod In reply to
What are you trying to do? What is the 'title' supposed to do to the link? The problem you're having is that 'title' is not defined in the sub, so the script does not know what to do. Notice:

($description) = @{$category{$subcat}}[2];
if ($field =~ m,^([^/]*)$,) {
$field2 = &build_clean($field);

Description equals something, as does field2. I don't see how you can have the link description as a part of the url? About the only thing that could go there (after the a, before the href) is 'class=' for CSS.

Please clarify your objective... Unimpressed


Leonard
aka PerlFlunkie
Quote Reply
Re: [PerlFlunkie] this cannot be this difficult... adding title=description to menu mod In reply to
the title tag in an href is analigous to the alt tag in an image, if you hover over a link with a title tag in the anchor then what is in the title tag will appear in a little yellow box next to the mouse cursor, though some older browsers do not recognize the tag. The reason i want to do this is because the menu bar on the left is a bit undescriptive so i would like the title tag to show the categories description (from the form field 3 in the category.def) when someone hovers over it. Its also helpful for search engine placement as the title in the anchor will lend weight to the page it is linked to just like an alt tag on an image will.

(not sure if this board will parse html but i will try to show an example LOL)

<a title="this is what pops up if there is ever a title tag" href="http://gossamer-threads.com">hover over this</a>

hmm well i guess it doesnt but you get the idea Wink




Vote Stinky

Last edited by:

security_man: Jul 8, 2004, 12:54 PM
Quote Reply
Re: [security_man] this cannot be this difficult... adding title=description to menu mod In reply to
Hm, I must've skipped that page in my book... Looked it up, and sure enough, you're on the right track. That's a cool feature, learn somethin' new (most) every day! Blush

Maybe you need to change to this?

foreach $subcat (sort @subcat) {
($description) = @{$category{$subcat}}[2];

and add this to the first part of the sub:

my (@subcat) = @_;


I don't KNOW perl, but I can usually rearrange things enough to get what I want...
Wink


Leonard
aka PerlFlunkie
Quote Reply
Re: [PerlFlunkie] this cannot be this difficult... adding title=description to menu mod In reply to
In Reply To:
I don't KNOW perl, but I can usually rearrange things enough to get what I want...
Wink




Vote Stinky