Gossamer Forum
Home : Products : Links 2.0 : Discussions :

Fun with Apostrophes

Quote Reply
Fun with Apostrophes
Hi -

One of my main categories has an apostrophe in it. Is this a major or minor problem? The name of the category is: "Who's Who?" and it is showing up as "Whos Who."

I imported my data with the IndexFinger import tool. Perhaps the error was in the import? I am not sure. Can anyone help make "Who's Who?" a category again?

Thanks,

Matthew
Quote Reply
Re: Fun with Apostrophes In reply to
Hi Matthew,

You can't have apostrophe's in category names unfortunately as categories are used as URL's and file names. This is a limitation of Links that I hope to fix in the next version, but for now you are stuck with Whos Who.

Cheers,

Alex
Quote Reply
Re: Fun with Apostrophes In reply to
I have a work around for the apostrophe problem:

Firstly, enter the category name into the database without apostrophes then:

Find the following in npi-build.cgi

Code:
sub build_linked_title {
# --------------------------------------------------------
# Returns a string of the current category broken up
# by section, with each part linked to the respective section.

my $input = shift;
my (@dirs, $dir, $output, $path, $last);

@dirs = split (/\//, $input);
$last = &build_clean(pop @dirs);

$output = qq| <A HREF="$build_root_url/">Top</A> :|;
foreach $dir (@dirs) {
$path .= "/$dir";
$dir = &build_clean ($dir);
$output .= qq| <A HREF="$build_root_url$path/">$dir</A> :|;
}

and add the following between the curly brace and
Code:
$output .= " $last";
return $output;

Code:
# Take the Category name and add an apostrophe in the correct place
if($last=~ /Whos Who/) {$last=~ s/Whos/Who's/;}

Now go to:

site_html_templates.pl and find:

Code:
# First let's get the name, number of links, and last modified date...
$url = "$build_root_url/" . &urlencode($subcat) . "/";
if ($subcat =~ m,.*/([^/]+)$,) { $category_name = &build_clean($1); } else { $category_name = &build_clean($subcat);}
$numlinks = $stats{"$subcat"}[0];
$mod = $stats{"$subcat"}[1];
if($category_name=~ /User Only/) {last;}

You need to insert the following line:

Code:
if($category_name=~ /Whos Who/) {$category_name=~ s/Whos/Who's/;}[/

An example is shown below:

Code:
# First let's get the name, number of links, and last modified date...
$url = "$build_root_url/" . &urlencode($subcat) . "/";
if ($subcat =~ m,.*/([^/]+)$,) { $category_name = &build_clean($1); } else { $category_name = &build_clean($subcat);}
if($category_name=~ /Whos Who/) {$category_name=~ s/Whos/Who's/;}
$numlinks = $stats{"$subcat"}[0];
$mod = $stats{"$subcat"}[1];

This is really only a hack as it only works if the category is at the end of the directory tree. I'm sure someone will be able to come up with a refinement on this.

------------------
www.whadup.com
mprice@acmex.com

[This message has been edited by melPrice (edited April 13, 2000).]

[This message has been edited by melPrice (edited April 13, 2000).]