4images Forum & Community
4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: Acidgod on December 01, 2005, 04:39:17 PM
-
Just a littel and simple MOD but it works and can be useful... (o:
Open the search.php
serach for:
$main_template = 'search';
replace with:
$mode = $HTTP_GET_VARS['mode'];
if ($mode==""){
$main_template = 'search';
} else {
$main_template = 'search_'.$mode;
}
search for:
$content = $site_template->parse_template("search_form");
replace with:
if ($mode==""){
$content = $site_template->parse_template("search_form");
} else {
$content = $site_template->parse_template("search_form_".$mode);
}
make a Copy of the seach_form.html and name it for Example seach_form_colorsearch.html
And also make a Copy of the search.html and name it search_colorsearch.html
Open the seach_form_colorsearch.html
search for:
<form method="post" action="{url_search}">
replace with:
<form method="post" action="{url_search}?mode=colorsearch">
Now when you are call the Search like this /search.php?mode=colorsearch the new search_colorsearch.html & search_form_colorsearch.html Template will be used... (o:
Now, for Example, you kann make a Dropdown like this one:
<select name="search_keywords" id="search_keywords">
<option value="red">red</option>
<option value="blue">blue</option>
<option value="black">black</option>
</select>
Open the search_form_colorsearch.html and replace the search inputfield:
<input type="text" name="search_keywords" size="40" value="{search_keywords}" class="input" />
with the Dropdown.
Now call the /search.php?mode=colorsearch and there is a Search where the User can only search for the three Colors in the Dropdown... (o:
Another Example:
you will make a other search, that they can only search for the Words Animal, Building, Nature and Ocean...
make a Copy of the seach_form.html and name it for Example seach_form_group.html
And also make a Copy of the search.html and name it search_group.html
Open the seach_form_group.html
search for:
<form method="post" action="{url_search}">
replace with:
<form method="post" action="{url_search}?mode=group">
Now when you are call the Search like this /search.php?mode=group the new search_group.html & search_form_group.html Template will be used... (o:
Now, for Example, you kann make a Dropdown like this one:
<select name="search_keywords" id="search_keywords">
<option value="animal">animal</option>
<option value="building">building</option>
<option value="nature ">nature </option>
<option value="ocean">ocean</option>
</select>
Open the search_form_group.html and replace the search inputfield:
<input type="text" name="search_keywords" size="40" value="{search_keywords}" class="input" />
with the Dropdown.
Now call the /search.php?mode=group and there is a Search where the User can only search for the Keywords in the Dropdown... (o:
-
did you add it to your page?
will have a look when back from holliday! :wink: :D
sincerly
vincent
-
Vincent is already again in holidays ... 8)
-
Sorry i have no Demo for this...
I dont need this so i have it not on my Page...
Maybe TIMT will post his Test Gallery... (o:
-
Hi everybody
here is my "Test Gallery": www.photofront.ch
you find a demo by klicking on "Profi Suche".
I implemented check boxes and a "multi-keyword-box".
But I still have a problem.
I have a picture with keyword "blödblöd" and a picture with keyword "gelgelgel".
When I enter in the field for keywords this two keywords and click on the radio button OR, both picture should be found.
That doesn't work. It works with the original search-function.
Would be nice, when Acidgod could check the problem. :wink:
Thanks!
-
The Problem is that PHP can handel multiple select only when you put it in an Array... But the search can´t handel Arrys without modifications... )o:
the only way to get this work is to make a string of the array...
open the search.php and search for:
*************************************************************************/
and replace it with:
*************************************************************************/
if ($search_keywords_multi){
$HTTP_POST_VARS['search_keywords'] = implode(" ", $search_keywords_multi);
$HTTP_GET_VARS['search_keywords'] = implode(" ", $search_keywords_multi);
}
if ($search_keywords_check){
$HTTP_POST_VARS['search_keywords'] = implode(" ", $search_keywords_check);
$HTTP_GET_VARS['search_keywords'] = implode(" ", $search_keywords_check);
}
$HTTP_POST_VARS['search_keywords'] .= " ".$HTTP_GET_VARS['search_keywords_check'];
$HTTP_POST_VARS['search_keywords'] .= " ".$HTTP_GET_VARS['search_keywords_multi'];
Then you must use a select multiple box like this:
<select size="4" class="input" name="search_keywords_multi[]" multiple>
<option value="Keyword1">Keyword1</option>
<option value="Keyword2">Keyword2</option>
<option value="Keyword3">Keyword3</option>
</select>
Then you must use checkboxes like this:
<input type="checkbox" name="search_keywords_check[]" value="Keyword1">
<input type="checkbox" name="search_keywords_check[]" value="Keyword2">
<input type="checkbox" name="search_keywords_check[]" value="Keyword3">
@TIMT
I have done this on your Test Site and it works well... (o:
-
Thank you! This is a great MOD! :D
-
How do I have to implement check boxes in the upload_form for pictures?
so the user can e.g. click on "red" and "blue" and "red" and "blue" will be stored as keywords.
Thanks!
-
*g*
Don´t now at the moment...
-
I implemented the following Code in member_uploadform.html
<table width="100%" class="row2">
<tr>
<td width="65" valign="top" class="row2">schwarz<input type="checkbox" name="image_keywords_check[]" value="schwarz"> </td>
<td width="65" valign="top" class="row2">grau<input type="checkbox" name="image_keywords_check[]" value="grau"> </td>
<td width="65" valign="top" class="row2">weiss<input type="checkbox" name="image_keywords_check[]" value="weiss"></td>
<td width="65" valign="top" class="row2">gelb<input type="checkbox" name="image_keywords_check[]" value="gelb"></td>
<td width="65" valign="top" class="row2">orange<input type="checkbox" name="image_keywords_check[]" value="orange"></td>
<td width="65" valign="top" class="row2">rot<input type="checkbox" name="image_keywords_check[]" value="rot"></td>
<td width="65" valign="top" class="row2">lila<input type="checkbox" name="image_keywords_check[]" value="lila"></td>
<td width="65" valign="top" class="row2">blau<input type="checkbox" name="image_keywords_check[]" value="blau"></td>
<td width="65" valign="top" class="row2">türkis<input type="checkbox" name="image_keywords_check[]" value="türkis"></td>
<td width="65" valign="top" class="row2">grün<input type="checkbox" name="image_keywords_check[]" value="grün"><br><br></td>
</tr>
</table>
The following code I entered in upload.php:
if ($image_keywords_check){
$HTTP_POST_VARS['image_keywords'] = implode(" ", $image_keywords_check);
$HTTP_GET_VARS['image_keywords'] = implode(" ", $image_keywords_check);
}
Nice try, not more.. it doesnt work...
-
Hi Acidgod
Within the checkboxes or within the multi selection, the OR and AND radio button works perfect. In combinatin with a keyword an a checkbox, or in combination with a keyword and a multi selection it doesn't work.
So you can enter "rot" as a keyword and select "Glück" in the multi selection and there are only image with the keyword "Glück" (www.photofront.ch / Profi Suche).
Thanks for helping me!
-
Hi
I have a problem with the FIX 19.02.06 (regarding News Box) and the "multiple select".
When I put the code regarding the fix below
include(ROOT_PATH.'global.php');
and above the code "multiple select" I have the following problem:
The multiple select works, but when I klick on a keyword, no images are shown.
When I put the code regarding the fix below
include(ROOT_PATH.'global.php');
and below the code "multiple select" I have the following problem:
With klick on a keyword I get all pictures whith which belongs to the keyword, but the multiple select doesn't work.
here the first version:
include(ROOT_PATH.'global.php');
if (isset($HTTP_POST_VARS['show_result']) || isset($HTTP_GET_VARS['show_result'])) {
$show_result = 1;
}
else {
$show_result = 0;
}
//----Zeige Users Album ---27.05.05------http://www.4homepages.de/forum/index.php?topic=4107.0----------
if (isset($HTTP_POST_VARS['search_lightbox']) || isset($HTTP_GET_VARS['search_lightbox'])) {
$search_ids = str_replace(",", ", ", trim((isset($HTTP_POST_VARS['search_lightbox'])) ? trim($HTTP_POST_VARS['search_lightbox']) : urldecode(trim($HTTP_GET_VARS['search_lightbox']))));
if ($search_lightbox != "") {
$show_result = 1;
}
}
else {
$search_lightbox = "";
}
//-------27.05.05------Ende------------
if (isset($HTTP_POST_VARS['search_keywords']) || isset($HTTP_GET_VARS['search_keywords'])) {
$search_keywords = (isset($HTTP_POST_VARS['search_keywords'])) ? trim($HTTP_POST_VARS['search_keywords']) : urldecode(trim($HTTP_GET_VARS['search_keywords']));
if ($search_keywords != "") {
$show_result = 1;
}
}
else {
$search_keywords = "";
}
$org_search_keywords = $search_keywords;
if (isset($HTTP_POST_VARS['search_user']) || isset($HTTP_GET_VARS['search_user'])) {
$search_user = (isset($HTTP_POST_VARS['search_user'])) ? trim($HTTP_POST_VARS['search_user']) : urldecode(trim($HTTP_GET_VARS['search_user']));
if ($search_user != "") {
$show_result = 1;
}
}
else {
$search_user = "";
}
$org_search_user = $search_user;
if (isset($HTTP_POST_VARS['search_terms'])) {
$search_terms = (trim($HTTP_POST_VARS['search_terms']) == "all") ? 1 : 0;
}
else {
$search_terms = 0;
}
if (isset($HTTP_POST_VARS['search_fields'])) {
$search_fields = trim($HTTP_POST_VARS['search_fields']);
}
else {
$search_fields = "all";
}
$search_cat = (isset($HTTP_POST_VARS['cat_id']) ) ? intval($HTTP_POST_VARS['cat_id']) : 0;
if (isset($HTTP_POST_VARS['search_new_images']) || isset($HTTP_GET_VARS['search_new_images'])) {
$search_new_images = 1;
$show_result = 1;
}
else {
$search_new_images = 0;
}
if ($search_keywords_multi){
$HTTP_POST_VARS['search_keywords_multi'] = implode(" ", $search_keywords_multi);
$HTTP_GET_VARS['search_keywords_multi'] = implode(" ", $search_keywords_multi);
}
if ($search_keywords_check){
$HTTP_POST_VARS['search_keywords_check'] = implode(" ", $search_keywords_check);
$HTTP_GET_VARS['search_keywords_check'] = implode(" ", $search_keywords_check);
}
$HTTP_POST_VARS['search_keywords'] .= " ".$HTTP_GET_VARS['search_keywords_check'];
$HTTP_POST_VARS['search_keywords'] .= " ".$HTTP_GET_VARS['search_keywords_multi'];
here the second version:
include(ROOT_PATH.'global.php');
if ($search_keywords_multi){
$HTTP_POST_VARS['search_keywords_multi'] = implode(" ", $search_keywords_multi);
$HTTP_GET_VARS['search_keywords_multi'] = implode(" ", $search_keywords_multi);
}
if ($search_keywords_check){
$HTTP_POST_VARS['search_keywords_check'] = implode(" ", $search_keywords_check);
$HTTP_GET_VARS['search_keywords_check'] = implode(" ", $search_keywords_check);
}
$HTTP_POST_VARS['search_keywords'] .= " ".$HTTP_GET_VARS['search_keywords_check'];
$HTTP_POST_VARS['search_keywords'] .= " ".$HTTP_GET_VARS['search_keywords_multi'];
if (isset($HTTP_POST_VARS['show_result']) || isset($HTTP_GET_VARS['show_result'])) {
$show_result = 1;
}
else {
$show_result = 0;
}
//----Zeige Users Album ---27.05.05------http://www.4homepages.de/forum/index.php?topic=4107.0----------
if (isset($HTTP_POST_VARS['search_lightbox']) || isset($HTTP_GET_VARS['search_lightbox'])) {
$search_ids = str_replace(",", ", ", trim((isset($HTTP_POST_VARS['search_lightbox'])) ? trim($HTTP_POST_VARS['search_lightbox']) : urldecode(trim($HTTP_GET_VARS['search_lightbox']))));
if ($search_lightbox != "") {
$show_result = 1;
}
}
else {
$search_lightbox = "";
}
//-------27.05.05------Ende------------
if (isset($HTTP_POST_VARS['search_keywords']) || isset($HTTP_GET_VARS['search_keywords'])) {
$search_keywords = (isset($HTTP_POST_VARS['search_keywords'])) ? trim($HTTP_POST_VARS['search_keywords']) : urldecode(trim($HTTP_GET_VARS['search_keywords']));
if ($search_keywords != "") {
$show_result = 1;
}
}
else {
$search_keywords = "";
}
$org_search_keywords = $search_keywords;
if (isset($HTTP_POST_VARS['search_user']) || isset($HTTP_GET_VARS['search_user'])) {
$search_user = (isset($HTTP_POST_VARS['search_user'])) ? trim($HTTP_POST_VARS['search_user']) : urldecode(trim($HTTP_GET_VARS['search_user']));
if ($search_user != "") {
$show_result = 1;
}
}
else {
$search_user = "";
}
$org_search_user = $search_user;
if (isset($HTTP_POST_VARS['search_terms'])) {
$search_terms = (trim($HTTP_POST_VARS['search_terms']) == "all") ? 1 : 0;
}
else {
$search_terms = 0;
}
if (isset($HTTP_POST_VARS['search_fields'])) {
$search_fields = trim($HTTP_POST_VARS['search_fields']);
}
else {
$search_fields = "all";
}
$search_cat = (isset($HTTP_POST_VARS['cat_id']) ) ? intval($HTTP_POST_VARS['cat_id']) : 0;
if (isset($HTTP_POST_VARS['search_new_images']) || isset($HTTP_GET_VARS['search_new_images'])) {
$search_new_images = 1;
$show_result = 1;
}
else {
$search_new_images = 0;
}
The Problem is that PHP can handel multiple select only when you put it in an Array... But the search can´t handel Arrys without modifications... )o:
the only way to get this work is to make a string of the array...
open the search.php and search for:
*************************************************************************/
and replace it with:
*************************************************************************/
if ($search_keywords_multi){
$HTTP_POST_VARS['search_keywords'] = implode(" ", $search_keywords_multi);
$HTTP_GET_VARS['search_keywords'] = implode(" ", $search_keywords_multi);
}
if ($search_keywords_check){
$HTTP_POST_VARS['search_keywords'] = implode(" ", $search_keywords_check);
$HTTP_GET_VARS['search_keywords'] = implode(" ", $search_keywords_check);
}
$HTTP_POST_VARS['search_keywords'] .= " ".$HTTP_GET_VARS['search_keywords_check'];
$HTTP_POST_VARS['search_keywords'] .= " ".$HTTP_GET_VARS['search_keywords_multi'];
Then you must use a select multiple box like this:
<select size="4" class="input" name="search_keywords_multi[]" multiple>
<option value="Keyword1">Keyword1</option>
<option value="Keyword2">Keyword2</option>
<option value="Keyword3">Keyword3</option>
</select>
Then you must use checkboxes like this:
<input type="checkbox" name="search_keywords_check[]" value="Keyword1">
<input type="checkbox" name="search_keywords_check[]" value="Keyword2">
<input type="checkbox" name="search_keywords_check[]" value="Keyword3">
@TIMT
I have done this on your Test Site and it works well... (o:
-
nice one
i'd love to know how can i make more than one Dropdown
to be like this
http://www.gsmarena.com/search.php3