Gossamer Forum
Home : Products : Links 2.0 : Customization :

Changing Category Delimter

Quote Reply
Changing Category Delimter
I have a large db with some 1500 categories
already defined with the ":" delimiter.

How do I change the "/" delimiter between categories and subcategories to ":".

For example, Software/Application I want to be Software:Application.

Also in looking at the Name filed definition in category.def, what do the "_" and "-" mean in that definition: (^[\w\d/_-]+$'],

Thanks
Quote Reply
Re: Changing Category Delimter In reply to
I suggest that you import the database based on the Links format, not try to change Links. The "/" is not really a delimeter as such. It is used by Links to denote sub directories in order to put the index.html file in each category's own directory but the "/" is part of the category's name. The actual delimiter used by links is the pipe symbol ("|") which is used to separate fields of a record with the end of line (newline) representing the delimiter between records.

The "_" and "-" in the field definition are allowable characters in a category's name. The entire thing says that you can use digits, any alphabetical letter, slash, underline, or hyphen, as part of the category name.
Quote Reply
Re: Changing Category Delimter In reply to
Yes, but....

I did that to test Links functionality, at least as far as the categories.db is concerned. But the goal is to use Links to manage our intranet web site with it's 2,000 categories and some 15,000 links.

So it's either change all those categories and their corresponding references in all the link records or change the delimiter to ":".
Quote Reply
Re: Changing Category Delimter In reply to
To be frank, it is not as simple as it appears to be on the surface. Links uses the "/", not only to determine sub-categories, but also to form directory names and create directories. So, you cannot just change the script to use ":" instead of "/" since the operating system itself uses the "/" for directories.

I suggest you start by going through all the subroutines of nph-build.cgi, db.pl, and db_utils.pl and find the code involved in using the "/" in category names and make the appropriate changes, being careful not to mess up the directory creation. There may be other scripts involved as well.

Or, write a script that will convert the ":" to "/" in the databases you want to convert. This would seem to be much simpler and less time consuming.

I wish you luck with it, either way!