Gossamer Forum
Home : Products : Gossamer Links : Discussions :

How to generate build_directory_field automatically from Full_Name

Quote Reply
How to generate build_directory_field automatically from Full_Name
I use build_directory_field to change "foreign characters" to pure ASCII:
My full path is for example "Muut linkit/S/Meris" and I have a field called Directory which has "Muut_linkit/Saa/Merisaa". What should I do to make Links SQL admin generate Directory entry automatically from Full_Name changing every space to _ and every umlauted character to non umlated like in my example?

This should be enough tr/ /aaouAAOU_/, but where to put it?

Lauri
Quote Reply
Re: [lpa] How to generate build_directory_field automatically from Full_Name In reply to
Is there anyone who could answer this question?

Lauri
Quote Reply
Re: [lpa] How to generate build_directory_field automatically from Full_Name In reply to
Lauri, LSQL will not generate automatically the directory names for you.
You have to type in yourself the directory names into the Directory column, or to copy the Full_Name column content to Directory column, then to correct the directory names yourself.
You can use the built DB manager for this.


However it would be a good idea to have the Directory names generated automatically. There would be possible to write such script which will automatically generate the Directory names from the Full_Name column, to match the directory name rules.

If you don't want to do it manually, you may want to post request for a paid script, into the "Custom Modification Jobs" forum...
(I could do it for you, but currently I really busy :-(

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] How to generate build_directory_field automatically from Full_Name In reply to
In Reply To:
However it would be a good idea to have the Directory names generated automatically. There would be possible to write such script which will automatically generate the Directory names from the Full_Name column, to match the directory name rules.

Yes I understood that Directory names are not generated automatically. I was just asking to get help on writing such a script that would do it. My greatest concern is what happens when you move a category to an other location. What will happen with the Directory field???? That should be regenerated from the Full_Name column and parsed to contain only the allowed characters.

Would this be a plugin and if, which hooks would it use?

Lauri
Quote Reply
Re: [lpa] How to generate build_directory_field automatically from Full_Name In reply to
I also needed such script, so I wrote it. And since it seems, there are people, who need such plugin, created the plugin.
The DirName converter plugin can do "Full_Name" to "directory name" conversion, exactly what you need. Also has a lot of options.

You can check for more info here (click to links below):
Categories names in _spanish_
or
Webmaster33's under development or planned plugins

Currently beta testing is going. It will be released within a week or two.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...

Last edited by:

webmaster33: Jan 15, 2003, 1:09 AM
Quote Reply
Re: [webmaster33] How to generate build_directory_field automatically from Full_Name In reply to
Why not do it the other way round - put the standard ASCII text (the path name) in the built-in category name field so that links builds the name properly ... then add a second CUSTOM field for DISPLAY NAME that includes the foreign characters for display in the HTML!

Just thought this might be easier?

All the best
Shaun
Quote Reply
Re: [qango] How to generate build_directory_field automatically from Full_Name In reply to
Quote:
add a second CUSTOM field for DISPLAY NAME that includes the foreign characters for display in the HTML
What you say is the Non-English field mod used in Links 2.0.
In Links SQL works differently. Full_Name field can contain almost any character, since it's the name of the category.
Until it contains just English chars & valid chars, the directories are based on Full_Name. Otherwise you have to use build_directory_field.

So why we need to use Full_Name:
1) Links SQL imports the Category field from Links 2.0 into Full_Name
2) The build_directory_field is exactly created for the task to contain valid directory paths
3) internally Full_Name is the main field in Links SQL, some tags are based on this field, like category_name_escaped or category_name. They are derived from Full_Name.
See the code in Links/Build.pm:
Code:
$display{category_name_escaped} = GT::CGI->escape ($category->{Full_Name});

I hope this answers your question.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] How to generate build_directory_field automatically from Full_Name In reply to
Ah ... when you put it like that I see what you mean!

Having never used the import feature, I hadn't realised exactly what the problem was - your explanation helps Smile

All the best
Shaun
Quote Reply
Re: [qango] How to generate build_directory_field automatically from Full_Name In reply to
BTW: I also have a plugin named L2S2 NonEnglish Category Name Converter plugin, which can convert Non-English field used in Links 2.0. It makes available Non-English category names available in Full_Name column, and also creates build_directory_field column.

The plugin is not released, however if anybody is interested in it, I will release it.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...