Ignore "(" and other special characters at the front of the first word.
design_dolphin - June 16, 2009 - 18:13
| Project: | Taxonomy VTN |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | AlexisWilke |
| Status: | active |
| Issue tags: | ignore special characters, taxonomy_vt |
Jump to:
Description
First thank you for a wonderful module. It is a pleasure to work with.
I am running into the problem where words are:
(This) is a term or (This) is a vocabulary
Where "(This) is a term" or "(This) is a vocabulary" gets listed in the vocabulary as:
(
(This) is a term I don't know how to fix this yet. Anyone else run into this?
Which file would be the best place to look to solve this?

#1
taxonomy_vtn_show_terms() in taxonomy_vtn/taxonomy_vtn.pages.inc
Btw, the best would be to add to the Vocabulary settings a set of characters to skip. So that way we could include all sorts of characters such as: .,-[]()@`"'
And if we can do it by vocabulary, it could get people the possibility to have a programming language like index (i.e. w3c.com CSS index has the '.' as an entry) and an English index.
Thank you.
Alexis
#2
O.k. it looks like this might possibly be the solution:
SELECT .... ORDER BY REPLACE(col,'(','');And then either add the REPLACE to taxonomy_vtn_overwrites.inc.php line 50 or/ and 62,
and/ or changing '$order' in taxonomy_vtn.pages.inc line 634.
Not sure yet if you can combine a DESC and REPLACE. So far I am getting code errors, which will have to be debugged.
Source of the code snippet at the top of this post is:
http://www.experts-exchange.com/Database/MySQL/Q_21346515.html
Edit: My bad AlexisWilke just noticed your post. Thank you for your quick reply. How to proceed?
#3
The SELECT order won't work. We do a sort in PHP. Especially because we want to use the locale the user selected in the Taxonomy VTN global setup.
And the REPLACE() command may not be SQL92 compatible and thus not work with PostgreSQL.
What I wanted to do, actually, was rewrite the enormous function displaying the terms into a set of functions that makes the function actually readable. The way it is now it just makes it real hard to maintain, and adding sorting capabilities is not easy.
Thank you.
Alexis
#4
Thank you.
The AZIndex plugin in Wordpress takes this approach. One is able to input the specific characters in the admin backend.
For details see:
'ignore-chars' in az-index-admin.php
and in az-index-content.php line 400 until 413
function az_get_ignorechars($index) {$chars = az_is_set($index->options, 'ignore-chars') ? htmlspecialchars_decode($index->ignorechars, ENT_QUOTES) : null;
if (!empty($chars)) {
// Add curly single quotes to the trim string.
if (strpos($chars, "'") !== false) {
$chars .= chr(145).chr(146);
}
// Add curly double quotes to the trim string.
if (strpos($chars, '"') !== false) {
$chars .= chr(147).chr(148);
}
}
return $chars;
}
I am not 100% sure this is the right code, but it seems to point in the correct direction. It would allow a setup from the backend. Not sure, yet, how to write this into the Taxonomy VTN code.
With many thanks to English Mike (http://englishmike.net/) for providing the plugin.
#5
In Drupal you'd have a variable_get() for the string of chars to ignore. I do not think we should automatically add characters as shown in your code snippet.
What we'd need is a compare function that will do something such as str_replace("bad chars", "", $term->name) before applying the comparison (similar to strcmp() but the one that takes the locale in account, strcol?.)
Thank you.
Alexis
#6
This is done in the newest version. Look inside your Taxonomy -> Vocabulary: edit there is an entry named "Unwanted characters in sort". You can enter any number. By default there are none.
Thank you.
Alexis Wilke
#7
Wanted to mark this fixed too. Feel free to reopen if it does not work for you. Make sure you get a version from Jun 20 or later.
Thank you.
Alexis
#8
Automatically closed -- issue fixed for 2 weeks with no activity.
#9
Hi Alexis!
I've tried to exclude guillemets (i.e. « and ») by typing them as a comma separated or space separated list but it doesn't seem to work (see http://www.liverbird.ru/taxonomy_vtn/term/595). Tested on my local machine (with latest dev installed) and production site (6.x.1-3)
Is it something wrong with those chars?
Thank you,
Ivan.
#10
Ivan,
The Unwanted characters in sort text field accepts a set of characters. No comma or space to separate the characters.
Also, you are unlikely to need the » quote since it probably won't matter in the sort.
The default, at this time, is:
.(@$_I suppose I could add the « in the default since many people uses those quotes in Europe.
Let me know whether that works better.
Thank you.
Alexis Wilke
#11
> The Unwanted characters in sort text field accepts a set of characters. No comma or space to separate the characters.
Yep, I forgot to say I'd tried to type those quotes and other characters as a set.
> Also, you are unlikely to need the » quote since it probably won't matter in the sort.
Yes, sure. I've mentioned it just as an explanation what symbols I meant.
> I suppose I could add the « in the default since many people uses those quotes in Europe.
Thank you, Alexis!
Ivan.
#12
Ivan,
Okay! I got it! Your problem is with the sorting of the nodes, not the sorting of the terms. I guess we should have the same effect on both lists.
Thank you.
Alexis Wilke
#13
> Okay! I got it! Your problem is with the sorting of the nodes, not the sorting of the terms. I guess we should have the same effect on both lists.
Oops! I was blind not to mark there's a difference between main topic and my issue. :)
Thank you!