Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Sub Categories using build_directory_field?

Quote Reply
Sub Categories using build_directory_field?
I'd like to use the build_directory_field to specify the name of the directories Links creates instead of the long winded ones created using the category name.

I understand that each directory name has to be unique to use this option, but my question is this: is there a way to have a sub-directory nested within it's parent directory so there isn't several hundred categories in the root directory on the server?

Thanks,
Amanda
Quote Reply
Re: [Evoken] Sub Categories using build_directory_field? In reply to
Hi,

You should be able to enter:

category/something_else

into the build_directory_field and it will create the two directories.

Is this what you mean?

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Sub Categories using build_directory_field? In reply to
I tried that and it didn't work! So I thought I'd seek help. Smile

From my understanding the build_directory_field allows an additional field to be inserted into the Category database. In this field, which I've called DirectoryName, I type in the name of the directory I want built (eg: international/canada), all of which is unrelated to the actual Category Name. However, when I try to add a sub category of "international" called "canada" the following error is returned:

Directory Name can not contain the value 'international/canada'

I'd like for the directory structure on the server to reflect the categories and subcategories of my database, which my visitors find very easy to use.

If I try to call the DirectoryName field 'international/canada', I get the above error. If I were to create the category Name 'International' with the DirectoryName of 'international', followed by a category Name of 'Canada' with the DirectoryName of 'canada' which is a subcategory of 'international', both of these directories are being built in the root directory of the server, and not nested.

My apologies if that sounds a bit confusing, I know what I'm trying to say but getting it down on the page briefly is a bit more difficult.
Quote Reply
Re: [Evoken] Sub Categories using build_directory_field? In reply to
Hi,

Do you have any regex for this field in its defs file?

Cheers,

Dat

Programming and creating plugins and templates
Blog
Quote Reply
Re: [tandat] Sub Categories using build_directory_field? In reply to
No I don't - but only because I don't know what to put there. I only found out about what a regex was a few days ago reading through the forum posts, but I wouldn't know where to start writing my own.
Quote Reply
Re: [Evoken] Sub Categories using build_directory_field? In reply to
Hi,

Ensure that in the Form Regex of the field is null or something like ^\w+\/\w+$

if you not sure, can send me a private message with your info so that I can take a look

Cheers,

Dat

Programming and creating plugins and templates
Blog
Quote Reply
Re: [tandat] Sub Categories using build_directory_field? In reply to
Well the regex for my "DirectoryName" field is currently null, but I'll give the one you posted a try and let you know how it goes.
Quote Reply
Re: [Evoken] Sub Categories using build_directory_field? In reply to
Sorry, I lie. I didn't put in a Form Regex for this field - LinksSQL did when I opted to include build_directory_field from the Build Options menu and I just left it as it was.

The field actually contains:

^[^/]+$
Quote Reply
Re: [tandat] Sub Categories using build_directory_field? In reply to
Tandat,

Your a life-saver! The form regex you provided works without any problems, and now my directory structure is as it should be - easy to navigate!

Thankyou for your help,
Amanda
Quote Reply
Re: [Evoken] Sub Categories using build_directory_field? In reply to
It's my pleasure Smile

Cheers,

Dat

Programming and creating plugins and templates
Blog
Quote Reply
Re: [tandat] Sub Categories using build_directory_field? In reply to
>>^\w+\/\w+$<<

You don't need to escape the forward slash.

Last edited by:

Paul: Mar 15, 2002, 3:01 AM
Quote Reply
Re: [Paul] Sub Categories using build_directory_field? In reply to
Thanks for your remind Pal Cool

Cheers,

Dat

Programming and creating plugins and templates
Blog
Quote Reply
Re: [tandat] Sub Categories using build_directory_field? In reply to
Im fussy I know Cool
Quote Reply
Re: [tandat] Sub Categories using build_directory_field? In reply to
Hi,

The regex above works great for the first level of subcategories, but when adding a second level subdirectory (/dir/subdir1/subdir2), the "Directory Name can not contain the value" error is returned again.

How could I modify ^\w+\/\w+$ to allow subcategories another level down?

Thanks,
Amanda
Quote Reply
Re: [Evoken] Sub Categories using build_directory_field? In reply to
Hi,

Yes it won't work if there more than once /

Try this ^\w+.+\w+$ but it not very accurately

Cheers,

Dat

Programming and creating plugins and templates
Blog
Quote Reply
Re: [tandat] Sub Categories using build_directory_field? In reply to
Thanks a bunch Tandat, it works like a charm (with the ones I tested)!
Quote Reply
Re: [tandat] Sub Categories using build_directory_field? In reply to
>>^\w+.+\w+$<<

You should probably do something like:

^[\w/]+$
Quote Reply
Re: [Paul] Sub Categories using build_directory_field? In reply to
I'll give that a whirl too. Thanks for the help, I'd be lost without this forum and the people here who take the time to help others. Smile