Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Lower Case Directory Names, but Multi-case Category names

Quote Reply
Lower Case Directory Names, but Multi-case Category names
Hi All

If I create some categories using any uppercase letters, those uppercase letters are also used in the naming of the static directories:

Categories - Fred, Wilma

Directories - http://www.mysite.com/Fred/, http://www.mysite.com/Wilma/

I would rather have all lowercase letters used for the directory names while keeping the case sensitivity for the Category Names:

Cats: Fred, Wilma

Directories: http://www.mysite.com/fred/, http://www.mysite.com/wilma/

Would anyone know how to do this? This also makes sense for any visitors because using all lowercase lettering is more the default than anything else.

Many Thanks Smile

------------------------------------------
Quote Reply
Re: [DogTags] Lower Case Directory Names, but Multi-case Category names In reply to
I've seen some perl that can take caps and convert them to lower case:

$category = lc($category); #all lower case

But, I'm not sure how to implement it in the script.

Any thoughts?

Many Thanks. Smile

------------------------------------------
Quote Reply
Re: [DogTags] Lower Case Directory Names, but Multi-case Category names In reply to
You could try this. COMPLETLY UNTESTED!

In /admin/Links/Build.pm, find;

Code:
$category = $cat_db->get($opts->{id}, 'HASH');

and add this below it;

Code:
$category = lc($category);

Give it a whirl, and let me know how it goes Tongue

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Lower Case Directory Names, but Multi-case Category names In reply to
Okay, here's the error I get:

Quote:
A fatal error has occured:Can't use string ("hash(0x8335e94)") as a HASH ref while "strict refs" in use at Links::Build::build_category line 37.

What should I try?

Many thanks. Smile

------------------------------------------
Quote Reply
Re: [DogTags] Lower Case Directory Names, but Multi-case Category names In reply to
Hi...I've had a little look further through this sub, and couldn't see anything related to the category being actually writeten. Basically, just look for an 'open' in Build.pm, which should be where the category is built from, and then add the lc() option around whatever variable the script uses to define the category.

Sorry I couldn't be much more help...but I've got a lot of work to do, and can't dedicate any more time to this Frown

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Lower Case Directory Names, but Multi-case Category names In reply to
$category is a hash reference hence the 'HASH' bit Wink ....you can't lowercase a reference to a hash Smile - you can however lowercase a value, like $category->{Name}
Quote Reply
Re: [Paul] Lower Case Directory Names, but Multi-case Category names In reply to
Thank you, both, Andy and Paul. I'll try to sort this out.

In fact, it would be nice to add an option to the default LinksSQL script for whether to make URLs all lower case or not. Like, in config, you could say:

URLs lower case.....YES

Thanks, again. Smile

------------------------------------------
Quote Reply
Re: [Paul] Lower Case Directory Names, but Multi-case Category names In reply to
I see.

Perhaps, when adding a category, there should be 2 boxes:

Category Name
Category URL

In Category Name, you would enter what you want your Navigation to say, and in Category URL, you could enter what you want that part of the URL to say.

Example:

Category Name: Gold_Mine
Category URL: goldmine

In your cat nav table, you would see "Gold Mine", but in the URL, you would see ..../goldmine/

The basic idea would be to build the page urls using a different field than the Category Name.

Would anyone know if this would be hard to hack in? I think this could be a neat addition.

Many thanks. Smile

------------------------------------------
Quote Reply
Re: [DogTags] Lower Case Directory Names, but Multi-case Category names In reply to
I am doing exactly this on my site. I had to write a plugin to get it to work - very site specific at the moment but I *might* get round to releasing it as a plugin after Christmas - bit busy at the moment.

Laura.
The UK High Street
Quote Reply
Re: [DogTags] Lower Case Directory Names, but Multi-case Category names In reply to
You can actually do this right now - it is built into LinksSQL.

In your SETUP, Build Options area you will see a field build_directory_field. Just create a table in your database (Category Table), enter the name in here, and this will be the path and the name of your Category.

I use it and it works like a charm.



Regards,



Clint.
--------------------------
http://AffiliatesDirectory.com
The Affiliate Programs Directory
Quote Reply
Re: [Clint] Lower Case Directory Names, but Multi-case Category names In reply to
Oh yes, I forgot about that. I remember trying to use that but I'm using them the other way round - i.e. the added field in my table was the printed name rather than the directory name. Now that I have a bit of a better knowledge of sql I might try swapping them round as this must be a lot more efficient than my plugin. Thanks for the tip Smile.

Laura.
The UK High Street
Quote Reply
Re: [Clint] Lower Case Directory Names, but Multi-case Category names In reply to
This doesn't seem to work for title_linked?

So I am still using my plugin to get the category names to be displayed in the title_linked tags - am I missing something?

Laura.
The UK High Street
Quote Reply
Re: [DogTags] Lower Case Directory Names, but Multi-case Category names In reply to
Hello!

The neat addition was added years ago. I have implemented it by adding a field called Dir in category table and have writted short forms of the directory names in there and in the Config added this column name for the build as mentioned.

Check it out on my website http://www.AtoZ.com
Quote Reply
Re: [Clint] Lower Case Directory Names, but Multi-case Category names In reply to
Hey, this sounds great. I'll give a try.

Many thanks! Smile

------------------------------------------
Quote Reply
Re: [afinlr] Lower Case Directory Names, but Multi-case Category names In reply to
Hi:

I use <%title_linked%> everywhere on my site and it works perfectly by using the method I outlined above.

eg.

Long Title: Computers and the Internet

category_path : /compinternet/ (this is the path to the category in the category_path field of the Category Table.

<%title_linked%> does show the path correctly - ie. to /compinternet/

The key is creating the category_path field in your Category Table, entering the short path for each category AND making sure you have this field name setup correctly in Links SETUP (in Build Options).

Hope this helps,



Regards,



Clint.
--------------------------
http://AffiliatesDirectory.com
The Affiliate Programs Directory
Quote Reply
Re: [Clint] Lower Case Directory Names, but Multi-case Category names In reply to
Thanks. It must be something I've done somewhere else because it isn't working. I think I'll leave it alone for the moment until I get some more time to find out what the problem is.

I do get the subcategories to work just not <%title_linked%>.

Laura.
The UK High Street
Quote Reply
Re: [DogTags] Lower Case Directory Names, but Multi-case Category names In reply to
In Reply To:
Hi All

If I create some categories using any uppercase letters, those uppercase letters are also used in the naming of the static directories:

Categories - Fred, Wilma

Directories - http://www.mysite.com/Fred/, http://www.mysite.com/Wilma/

I would rather have all lowercase letters used for the directory names while keeping the case sensitivity for the Category Names:

Cats: Fred, Wilma

Directories: http://www.mysite.com/fred/, http://www.mysite.com/wilma/

Would anyone know how to do this? This also makes sense for any visitors because using all lowercase lettering is more the default than anything else.

Many Thanks Smile


I did this:
Enter mysql monitor (backup database first)
Do this for the whole aphabet (one at a time):
UPDATE lsql_Category SET Full_Name = REPLACE(Full_Name,"A","a")
UPDATE lsql_Category SET Full_Name = REPLACE(Full_Name,"B","b")
etc etc

The result is lower case directories and since you are only changing the filed "Full_Name" the <%category%> tag will still output the upper case directory names on the home page and category pages.

I am sure there is an easier way to do this, but I am a novice. Bottom line is that it works.

Mike
Quote Reply
Re: [Palehorse777] Lower Case Directory Names, but Multi-case Category names In reply to
In Reply To:

I did this:
Enter mysql monitor (backup database first)
Do this for the whole aphabet (one at a time):
UPDATE lsql_Category SET Full_Name = REPLACE(Full_Name,"A","a")
UPDATE lsql_Category SET Full_Name = REPLACE(Full_Name,"B","b")
etc etc

The result is lower case directories and since you are only changing the filed "Full_Name" the <%category%> tag will still output the upper case directory names on the home page and category pages.

I am sure there is an easier way to do this, but I am a novice. Bottom line is that it works.

Mike
Yep, there is an easier way with one query...

Code:
UPDATE lsql_Category SET Full_Name = lower(Full_Name);
Quote Reply
Re: [Clint] Lower Case Directory Names, but Multi-case Category names In reply to
In Reply To:
In your SETUP, Build Options area you will see a field build_directory_field. Just create a table in your database (Category Table), enter the name in here, and this will be the path and the name of your Category.

I can't find this field in Glinks 3.0.4

Would anyone know how to accomplish this in the latest glinks?

I'd like to make lowercase all my URLs but keep the mixed case category names

Category1
.../category1

Thanks Smile

------------------------------------------
Quote Reply
Re: [DogTags] Lower Case Directory Names, but Multi-case Category names In reply to
The StaticURLtr could do this for you if you're building static pages (although it's a little tedious, since you currently need to add all capital letters to lowercase replacements). Quite a few people have been wanting to lowercase everything, so I'm going to update the plugin to have an option to do this.

Adrian