• [Mod] Add a keyword list to the search form v.2 5 0 5 1
Currently:  

Author Topic: [Mod] Add a keyword list to the search form v.2  (Read 108243 times)

0 Members and 1 Guest are viewing this topic.

Offline BlueScorpion

  • Newbie
  • *
  • Posts: 16
  • BlueScorpion
    • View Profile
    • Homepage von BlueScorpion
Re: [Mod] Add a keyword list to the search form v.2
« Reply #45 on: May 23, 2007, 01:51:55 PM »
@novw
I use version 1.7.4 and I paste the code before the IF-clause and it works fine, try it. :)

@MOD-Designer Chris ;)
Congratultions for this great MOD.

One fact, i tried to use the original searchfield and your keywords-list together.
one example: search field: "cars 2007" keywords-list: "blue"
The result was: "cars 2007blue"

I was looking for a fix and found this one:

Search in search.php
$org_search_keywords .= trim(" ".$search_keyword_list);

change to
$org_search_keywords .= " " . trim(" ".$search_keyword_list);

Good Luck
BluE

EDIT: Sorry but I find out that my "fix" disable the paging function in search results.
solution 1:
search: "if ($search_keywords != "" && $show_result == 1) {"
change to: "if ($search_keywords != "" && $search_keywords != " " && $show_result == 1) {"

solution 2:
search: "  $org_search_keywords .= " " . trim(" ".$search_keyword_list);
              $search_keywords = $org_search_keywords;"
move to the IF-clause so that the additional " " only paste in when keywords-list exists.
« Last Edit: May 23, 2007, 02:53:55 PM by BlueScorpion »

Offline Buggy Driver

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: [Mod] Add a keyword list to the search form v.2
« Reply #46 on: June 27, 2007, 12:54:39 PM »
I installed this mod today.

Works like a charmed
Being my bad self I just needed to  change a few tings

Based on BlueScorpion post
http://www.4homepages.de/forum/index.php?topic=3850.msg93826#msg93826

look for
Code: [Select]
$org_search_keywords .= trim(" ".$search_keyword_list);
$search_keywords = $org_search_keywords;

change to  (solution 3:)
Code: [Select]
$org_search_keywords .= " ".$search_keyword_list;
$search_keywords = trim($org_search_keywords);

based on airphoto post
http://www.4homepages.de/forum/index.php?topic=3850.msg15953#msg15953

in functions.php  (4images 1.7.4)
look for
Code: [Select]
$sql = "SELECT `image_keywords` FROM ".IMAGES_TABLE." WHERE 1 order by `image_keywords` DESC";

change in to
Code: [Select]
$sql = "SELECT `image_keywords` FROM ".IMAGES_TABLE." WHERE 1 AND cat_id IN (".get_auth_cat_sql("auth_viewcat").") order by `image_keywords` DESC";

now the list show only keywords from the catagories that members/guests are allowed to view

Offline BlueScorpion

  • Newbie
  • *
  • Posts: 16
  • BlueScorpion
    • View Profile
    • Homepage von BlueScorpion
Re: [Mod] Add a keyword list to the search form v.2
« Reply #47 on: June 28, 2007, 09:10:58 PM »
I tried out the change posted by Buggy Driver to show only authenticated keywords,
in my case there is the word "geschenk" which is only a keyword in a category for registered users only, but after the change guests still get the keyword in the ajax-keyword-list.

where is the problem?
or did i missunderstand the function of this change?

greetings
bluE

Offline Buggy Driver

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: [Mod] Add a keyword list to the search form v.2
« Reply #48 on: June 28, 2007, 09:52:49 PM »
I tried out the change posted by Buggy Driver to show only authenticated keywords,
in my case there is the word "geschenk" which is only a keyword in a category for registered users only, but after the change guests still get the keyword in the ajax-keyword-list.

where is the problem?
or did i missunderstand the function of this change?

greetings
bluE

if you choose that word do you get an images as a result?

The change just uses the existing   get_auth_cat_sql("auth_viewcat") function
The result of that function is a list of all categories that the current visitor has access to

Offline BlueScorpion

  • Newbie
  • *
  • Posts: 16
  • BlueScorpion
    • View Profile
    • Homepage von BlueScorpion
Re: [Mod] Add a keyword list to the search form v.2
« Reply #49 on: June 28, 2007, 10:00:39 PM »
no i don't get the images but this works without your change of sql-statement still before.

i thought the guest won't see the keywords of "user-images" only of "guest-images"?! or isn't it?
blue

Offline BlueScorpion

  • Newbie
  • *
  • Posts: 16
  • BlueScorpion
    • View Profile
    • Homepage von BlueScorpion
Re: [Mod] Add a keyword list to the search form v.2
« Reply #50 on: June 29, 2007, 09:33:23 AM »
Sorry,

it was my mistake.
I thought this change has a bearing on my ajax-search-input-field too, but it's only for the keywordlist (title of this thread) ;)

Sry for that and thanks for help.

BluE

Offline getcom

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: [Mod] Add a keyword list to the search form v.2
« Reply #51 on: September 06, 2007, 04:41:41 PM »
Great mod, but can this be changed so you could have more than one dropdown list say like a dropdown list for colour and one for shape and one for 3d or not. so the search would then do a search for say the colour red+AND+square+AND+3d. this way they could have 3 choices to choose from or use all three.

Would be great if could be done

Many thanks

Offline myr2904

  • Newbie
  • *
  • Posts: 37
    • View Profile
Re: [Mod] Add a keyword list to the search form v.2
« Reply #52 on: January 20, 2008, 01:03:19 AM »
Is it possible to have this mod like this?


Is it not possible to have this mod a bit modifieyed 

i would like to have it like this

A B C D E F G H I J K L M N O P .............. X Y Z
-------------------------------------------------------------------
- A -

Asien                  Armee                         Acrikultur
Armut                 arbeit                          Architektur
arbeitslos             arbeiter                       anatolien

usw usw
-----------------------------------------------------------------------

gruss
vincent

Offline shadowhunter

  • Full Member
  • ***
  • Posts: 114
    • View Profile
    • Fotogalerie & Fotocommunity scluzern.com
Re: [Mod] Add a keyword list to the search form v.2
« Reply #53 on: June 06, 2008, 06:13:00 PM »
Hallo!
Ich habe noch 2 Probleme bei diesem Mod gefunden und behoben betreffend der Sortierung:

Vorher:
Quote
Aab
(...)
blablabla
(...)
Zzz
aaa
Äaa


Nachher mit neuem Code:
Quote
Aaa
Aab
Aeaa
(...)
blablabla
(...)
Zzz


Suche in includes/functions.php:
Code: [Select]
$array[] = $temp;
Ersetze durch:
Code: [Select]
$temp = strtr($temp, array("Ä" => "Ae", "Ö" => "Oe", "Ü" => "Ue","ä" => "ae", "ö" => "oe", "ü" => "ue"));
        $array[] = ucfirst($temp);

Behobene Probleme bei der Sortierung:
Umlaute & wenn 1. Buchstabe klein ist.

Gruss Jones

Offline alekinna

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
    • Gallery of cross-stitching
Re: [Mod] Add a keyword list to the search form v.2
« Reply #54 on: September 05, 2008, 04:41:52 PM »
I did little modification, based on this mod, that add keyword list to admin panel (textarea, not dropdown form).But first:
1. It will add keyword list only to form "check new images"
2. I'm not a programmer and perhaps it is no correct way to do this, but it work for me.

Open includes/functions.php, locate this code at the very bottom:
Code: [Select]
?>
Change it to the following:
Code: [Select]
// --------------- Add a list of keywords to the admin form "check new images" BEGIN -------------------------------
function get_keyword_list_admin() {
  global $lang, $site_sess, $site_db;
  $keyword_dropdown = "";
  $keyword_dropdown .= "<textarea name=\"search_keyword_list[]\" cols=\"30\" rows=\"8\" class=\"setperpageselect\">\n";
  $sql = "SELECT `image_keywords` FROM ".IMAGES_TABLE." WHERE 1 order by `image_keywords` DESC";
  $result = $site_db->query($sql);
  $array = array();
  while(list($Name) = mysql_fetch_row($result)) {
// Commented out until enforcement of user/category/image permissions is developed
//    if (!check_permission("auth_viewimage", $image_row['cat_id']) || !check_permission("auth_viewcat", $image_row['cat_id'])) {
    if(!empty($Name)) {
      $explode_array = explode(" ",$Name);
      for($ctr=0; $ctr < count($explode_array); $ctr++){
        $temp = $explode_array[$ctr];
        $array[] = $temp;
      }
    }
  }
  $site_db->free_result();
  $array1 = array_unique($array); // Remove duplicate values from the array
  if (!empty($array1)) {
    natcasesort($array1); // Sort the array by A-Z, case insensitive
    foreach($array1 as $val) {
       $keyword_dropdown .= $val."\n";
    }
  }
  $keyword_dropdown .= "</textarea>\n";
  return $keyword_dropdown;
}
//----------------------------- Add a list of keywords to the admin form "check new images" END ---------------------------

?>

Open admin/checkimages.php, locate this code:
Code: [Select]
$title = $lang['field_keywords_ext'].((isset($file_src)) ? get_iptc_insert_link($file_src, "keyword", "image_keywords_".$ii) : "");
Change it to the following:
Code: [Select]
$title = $lang['field_keywords_ext'].((isset($file_src)) ? get_iptc_insert_link($file_src, "keyword", "image_keywords_".$ii) : "")."<br />".get_keyword_list_admin();

Offline AntiNSA2

  • Hero Member
  • *****
  • Posts: 774
  • As long as I can finish my site before I die.
    • View Profile
    • http://www.thelifephotography.com
Re: [Mod] Add a keyword list to the search form v.2
« Reply #55 on: June 04, 2009, 11:37:28 AM »
Greetings , Im using 1.76 and in step one it says to find this
Code: [Select]
$org_search_keywords = $search_keywords;

if (isset($HTTP_POST_VARS['search_user']) || isset($HTTP_GET_VARS['search_user'])) {

however  I have a different code in mine:
Code: [Select]
$org_search_keywords = $search_keywords;
$org_search_user = $search_user;

if (isset($HTTP_GET_VARS['search_terms']) || isset($HTTP_POST_VARS['search_terms'])) {
I would love to use this mod if someone can make it work for 1.7.6
As long as I can finish my site before I die.

Offline dp

  • Newbie
  • *
  • Posts: 37
    • View Profile
Re: [Mod] Add a keyword list to the search form v.2
« Reply #56 on: November 30, 2009, 12:46:59 PM »
Greetings , Im using 1.76 and in step one it says to find this
Code: [Select]
$org_search_keywords = $search_keywords;

if (isset($HTTP_POST_VARS['search_user']) || isset($HTTP_GET_VARS['search_user'])) {

however  I have a different code in mine:
Code: [Select]
$org_search_keywords = $search_keywords;
$org_search_user = $search_user;

if (isset($HTTP_GET_VARS['search_terms']) || isset($HTTP_POST_VARS['search_terms'])) {
I would love to use this mod if someone can make it work for 1.7.6

I'm running this Mod succesfully with v 1.7.7.
Don't mind about the diffenrent code you pointed out. Just place the mod's code after it.

Offline dp

  • Newbie
  • *
  • Posts: 37
    • View Profile
Re: [Mod] Add a keyword list to the search form v.2
« Reply #57 on: January 09, 2010, 06:57:51 PM »
This Mod works fine up to 5700 Images and nearly 800 keywords in my database. But when I add some more pictures, the function get_keyword_list() in functions.php exceeds the memory limit of 32 M of my server and the searchform could not be displayed anymore.

Responsible was this line

 
Code: [Select]
$array1 = array_unique($array); // Remove duplicate values from the array
This line is essential, of course. So imho this mod is for small galleries only.

Offline surferboy

  • Full Member
  • ***
  • Posts: 142
    • View Profile
Re: [Mod] Add a keyword list to the search form v.2
« Reply #58 on: April 22, 2010, 07:19:01 AM »
Hey DP,

Just read your post. Was thinking about adding this MOD. We anticipate our community having upwards of 10,000 - 15,000 images within a couple of years BUT the keywords will be around 70 -90.

Do you think the server memory limits of 32MB would operate properly with these fewer keywords? In other words, my question is what tips the scales, the number of keywords or the total number of images?

Thanks for any advice you can give.

Brian

Offline dp

  • Newbie
  • *
  • Posts: 37
    • View Profile
Re: [Mod] Add a keyword list to the search form v.2
« Reply #59 on: May 18, 2010, 02:02:36 PM »
Hey DP,

Just read your post. Was thinking about adding this MOD. We anticipate our community having upwards of 10,000 - 15,000 images within a couple of years BUT the keywords will be around 70 -90.

Do you think the server memory limits of 32MB would operate properly with these fewer keywords? In other words, my question is what tips the scales, the number of keywords or the total number of images?

Thanks for any advice you can give.

Brian

Hi Brian,

sorry for the delay.
My server is running with 32M, so there is no different to your environment. The memory limit exceeds by the function which erases keyword duplicates. This can be caused by both, number of images and number of keywords per image, imho. In your case I would give it a trial, it's not much work at all. If you try, post your experience here, please.