4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Requests & Discussions) => Topic started by: MrAndrew on February 11, 2010, 12:35:05 PM

Title: Spaces in upload fields
Post by: MrAndrew on February 11, 2010, 12:35:05 PM
I need help.

When i fill forms in my upload page, i need to write USA-Washington, instead USA Washington, becouse search of site will search by first word until the space. If i will write
USA Washington
USA New York
it will search result only for USA, and will show as USA Washington, as USA New York. but i need show only USA Washington
When i write USA-Washington it work done, but view not beauty with "-".

How i can realise it?
Title: Re: Spaces in upload fields
Post by: V@no on February 12, 2010, 07:45:43 AM
I don't know what fields you are referring to, but here is a quick fix for "keywords" field. But I must mention, I did not fully test it and it might break something on your gallery, you also will need use semicolon instead of space to separate keywords:
some;keywords;keywords can;be with spaces
these modifications should not affect existing keywords

in includes/functions.php find:
    $split_keywords = explode(" ", $image_row['image_keywords']);
replace it with:
    $split_keywords = explode(";", $image_row['image_keywords']);


in includes/search_utils.php find:
  $split_words = preg_split("/\s+/", $val);

Replace it with:
  $split_words = explode(";", $val);


find:
  foreach ($split_words as $word) {
    if ($word == "") {

Replace it with:
  foreach ($split_words as $word) {
    $word = trim($word);
    if ($word == "") {
Title: Re: Spaces in upload fields
Post by: milanNN on January 13, 2011, 09:46:15 AM
I did it but problem is remained still.
BTW if i write USA- Washington all is OK.
But USA -Washington or USA - Washington is not good(Your search resulted in no matching records).
Can you help me?