|
|
phpBB2 by Przemo
Support forów phpBB2 modified by Przemo
|
|
Search for UMLAUTE -> quick and dirty MOD here! |
Autor |
Wiadomość |
bitboy0
Posty: 17
|
Wysłany: 20-05-2004, 13:07 Search for UMLAUTE -> quick and dirty MOD here!
|
|
|
Why it normaly doesn't work:
The search.php filters out all the ilegal chars and stores only the international ones. So f.e. if someone posts
Kühlung
the board cuts of the "ü" and because of it makes no sense to store the "K" as a single char it stores only "hlung" ...
So what I do is to replace the ilegal chars with codes that are allowed! from "ü" I make "ue" for example. This is done before the Board checks for ilegal chars. The word with the replaced chars is only stored in the search_wordlist - Table on the MySQL-Server... NOT in the post_text ... so noone can ever see the "translated" words ... The replacement chars must be selectet in an way that no regular word contains them ... so choose construktions like "xa1x" for "á" if you like to add your languages spezial chars. The german "Umlaute" are special because the replacement "ae" for an "ä" is often used if Umlaute are not available on a keyboard.
Here the small changes:
open includes/functions_search.php
find Kod: | if ( $mode == 'post' )
{ | and add after Kod: | // Replace german Umlaute by international Chars
$entry = str_replace ( "ä","ae",$entry);
$entry = str_replace ( "ö","oe",$entry);
$entry = str_replace ( "ü","ue",$entry);
$entry = str_replace ( "ß","ss",$entry);
$entry = str_replace ( "Ä","Ae",$entry);
$entry = str_replace ( "Ö","Oe",$entry);
$entry = str_replace ( "Ü","Ue",$entry); | save and upload!
open search.php
find Kod: | if ( isset($HTTP_POST_VARS['search_keywords']) || isset($HTTP_GET_VARS['search_keywords']) )
{
$search_keywords = ( isset($HTTP_POST_VARS['search_keywords']) ) ? $HTTP_POST_VARS['search_keywords'] :
$HTTP_GET_VARS['search_keywords']; | and add after Kod: | // Umlaute MOD
$search_keywords_old = str_replace("*","",$search_keywords);
$search_keywords_old = str_replace(" AND "," ",$search_keywords_old);
$search_keywords_old = str_replace(" OR "," ",$search_keywords_old);
$search_keywords_old = str_replace(" NOT "," ",$search_keywords_old);
$search_keywords_old = str_replace(" and "," ",$search_keywords_old);
$search_keywords_old = str_replace(" or "," ",$search_keywords_old);
$search_keywords_old = str_replace(" not "," ",$search_keywords_old);
$search_keywords = str_replace ( "ä","ae",$search_keywords);
$search_keywords = str_replace ( "ö","oe",$search_keywords);
$search_keywords = str_replace ( "ü","ue",$search_keywords);
$search_keywords = str_replace ( "ß","ss",$search_keywords);
$search_keywords = str_replace ( "Ä","Ae",$search_keywords);
$search_keywords = str_replace ( "Ö","Oe",$search_keywords);
$search_keywords = str_replace ( "Ü","Ue",$search_keywords); |
find Kod: | $highlight_active = '';
$highlight_match = array(); | and add after Kod: | // Umlaute MOD
$split_search = split(' ',$search_keywords_old);
| save and upload!
go to the Admin-Panel and Rebuild-Search ...
After that it should work.
If you find a better way to replace the ilegal chars or any other good idea .. just post it here This is not a complete solution... there are some situations where this finds more than the words you're searching for ... but without this MOD you can't find any word with special-chars...
regards Sven |
|
|
|
 |
Gadatliwa Kasia
|
|
|
|
Przemo


Pomógł: 210 razy Posty: 3148
|
Wysłany: 20-05-2004, 13:36
|
|
|
Nice, if I find a completed mod for replacement all possible chars I will install it to my package. |
|
|
|
 |
|
Nie możesz pisać nowych tematów Nie możesz odpowiadać w tematach Nie możesz zmieniać swoich postów Nie możesz usuwać swoich postów Nie możesz głosować w ankietach Możesz załączać pliki na tym forum Możesz ściągać załączniki na tym forum
|
Dodaj temat do Ulubionych Wersja do druku
|
Kopiowanie wszelkich treści zawartych na forum, modyfikacji oraz instrukcji bez zgody administracji i autorów tematów/postów zabronione!
Powered by phpBB modified by Przemo © 2003 phpBB
| Strona wygenerowana w 0,1 sekundy. Zapytań do SQL: 11 | |
 |
|