|
Page 1 of 1
|
dilirum
Joined: March 2007
Posts: 14
|
 FAP CUSTOMIZATION - FAP Search Multiple Fields
I've been looking for a way to do this for awhile now. Searched many phpbb boards and mightygordon boards.
Current search system has a drop down box to search either username, picture title or description. I'd like to perform a search and return results for all those fields at once (well probably not username, but at least title and description). I'm not a php expert but can stumble my way around. I tried a few different things (mainly hard coding a search function) but I can't get it to search more than one field without erroring out with a "Bad Request" message.
Any ideas on how to implement this? Can't imagine it would be too intensive. Thanks in advance for any ideas anybody can give me in the right direction.
|
#1 Sun 11 Mar, 2007 03:07 |
|
Sponsors

|
Icy Phoenix is an open source project, you can show your appreciation and support future development by donating to the project.
|
|
Mighty Gorgon 
Luca Libralato
Joined: August 2006
Posts: 7192
Location:  Borgo San Michele
|
 Re: FAP Search Multiple Fields
I've been looking for a way to do this for awhile now. Searched many phpbb boards and mightygordon boards.
Current search system has a drop down box to search either username, picture title or description. I'd like to perform a search and return results for all those fields at once (well probably not username, but at least title and description). I'm not a php expert but can stumble my way around. I tried a few different things (mainly hard coding a search function) but I can't get it to search more than one field without erroring out with a "Bad Request" message.
Any ideas on how to implement this? Can't imagine it would be too intensive. Thanks in advance for any ideas anybody can give me in the right direction.
At the moment I have no time...
I'll try to do it when I have some free time... but maybe Lefty or Artie will have a play too.
____________ Luca
SEARCH is the quickest way to get support.
Icy Phoenix ColorizeIt - CustomIcy - HON
|
#2 Sun 11 Mar, 2007 14:15 |
|
dilirum
Joined: March 2007
Posts: 14
|
 Re: FAP Search Multiple Fields
Thanks for the reply.
Anyone?
|
#3 Mon 12 Mar, 2007 09:35 |
|
dilirum
Joined: March 2007
Posts: 14
|
 Re: FAP Search Multiple Fields
Main reason i'm looking for this is to search from outside phpBB. I want to have an HTML form where users can enter a keyword then use a drop down box to search "album, forum, etc." including other pages on my site. But I really don't want it to be "album description, album title, forum, etc." Just too many options there. Want to keep it simple and use search album to automatically search both fields.
Anybody have any idea on how to get the search function to search both fields?
|
#4 Tue 20 Mar, 2007 04:05 |
|
Mighty Gorgon 
Luca Libralato
Joined: August 2006
Posts: 7192
Location:  Borgo San Michele
|
 Re: FAP Search Multiple Fields
I gues you could have a try modifying album_search.php in some way like this...
- AND (p.pic_desc LIKE '%" . $s . "%' OR p.pic_title LIKE '%" . $s . "%' OR p.pic_username LIKE '%" . $s . "%')
Have a try and let me know...
____________ Luca
SEARCH is the quickest way to get support.
Icy Phoenix ColorizeIt - CustomIcy - HON
|
#5 Thu 22 Mar, 2007 01:56 |
|
dilirum
Joined: March 2007
Posts: 14
|
 Re: FAP Search Multiple Fields
Gorgon,
Thanks for the help but I'm really not sure where to put that. I'm not that great with PHP, just basically stumble my way around. Sorry.
I played with my album_search.php but it doesn't seem to work anyplace I try to insert tha, but again, I'm not sure of what I'm doing.
|
#6 Thu 22 Mar, 2007 19:51 |
|
Artie 
Joined: January 2007
Posts: 833
Location:  Lone Star State
|
 Re: FAP Search Multiple Fields
This may get you close to what you're lookin for.
#
## ---- [ OPEN ] -------------------------------------------------------------------------------------------
#
includes/page_header.php
#
## ---- [ FIND ] ----------------------------------------------------------------------------------------------
#
'L_DESCRIPTION' => $lang['Description'],
#
## ---- [ AFTER ADD ] ------------
#
'L_TITLE_DESCRIPTION' => $lang['Title_Description'],
#
## ---- [ OPEN ] ------------------------------------------------------------------------------------------
#
language/lang_english/lang_main.php
#
## ---- [ FIND ] ------------
#
$lang['Description'] = 'Description';
#
## ---- [ AFTER ADD ] -----------------------------------------------------------------------------------
#
$lang['Title_Description'] = 'Title & Description';
#
## ---- [ OPEN ] ------------
#
album_search.php
#
## ---- [ FIND ] -------------------------------------------------------------------------------------------
#
if ($m == 'user')
{
$where = 'p.pic_username';
}
elseif ($m == 'name')
{
$where = 'p.pic_title';
}
elseif ($m == 'desc')
{
$where = 'p.pic_desc';
}
else
{
message_die(GENERAL_ERROR, 'Bad request');
}
#
## ---- [ REPLACE WITH ] ----------------------------------------------------------------------------------------
#
if ($m == 'user')
{
$where = "AND p.pic_username LIKE '%" . $s . "%'";
}
elseif ($m == 'name')
{
$where = "AND p.pic_title LIKE '%" . $s . "%'";
}
elseif ($m == 'desc')
{
$where = "AND p.pic_desc LIKE '%" . $s . "%'";
}
elseif ($m == 'title_desc')
{
$where = "AND (p.pic_desc LIKE '%" . $s . "%' OR p.pic_title LIKE '%" . $s . "%')";
}
else
{
message_die(GENERAL_ERROR, 'Bad request');
}
#
## ---- [ FIND ] -------------------------------------------------------------------------------------------------------------
#
$count_sql = "SELECT COUNT(pic_id) AS count
FROM " . ALBUM_TABLE . ' AS p,' . ALBUM_CAT_TABLE . " AS c
WHERE p.pic_approval = 1
AND " . $where . " LIKE '%" . $s . "%'
" . $search_pg . "
AND p.pic_cat_id = c.cat_id";
#
## ---- [ REPLACE WITH ] ---------------------------------------------------------------------------------------------------
#
$count_sql = "SELECT COUNT(pic_id) AS count
FROM " . ALBUM_TABLE . ' AS p,' . ALBUM_CAT_TABLE . " AS c
WHERE p.pic_approval = 1
" . $where . $search_pg . "
AND p.pic_cat_id = c.cat_id";
#
## ---- [ FIND ] ------------------------------------------------------------------------------------------------------------------
#
$sql = "SELECT p.pic_id, p.pic_title, p.pic_desc, p.pic_user_id, p.pic_username, p.pic_time, p.pic_cat_id, p.pic_approval, c.cat_id, c.cat_title, c.cat_user_id
FROM " . ALBUM_TABLE . ' AS p,' . ALBUM_CAT_TABLE . " AS c
WHERE p.pic_approval = 1
AND " . $where . " LIKE '%" . $s . "%'
AND p.pic_cat_id = c.cat_id
" . $search_pg . "
ORDER BY p.pic_time DESC LIMIT ".$limit_sql."";
#
## ---- [ REPLACE WITH ] ---------------------------------------------------------------------------------------------------------------
#
$sql = "SELECT p.pic_id, p.pic_title, p.pic_desc, p.pic_user_id, p.pic_username, p.pic_time, p.pic_cat_id, p.pic_approval, c.cat_id, c.cat_title, c.cat_user_id
FROM " . ALBUM_TABLE . ' AS p,' . ALBUM_CAT_TABLE . " AS c
WHERE p.pic_approval = 1
" . $where . "
AND p.pic_cat_id = c.cat_id
" . $search_pg . "
ORDER BY p.pic_time DESC LIMIT ".$limit_sql."";
#
## ---- [ OPEN ] ------------
# (each of these 8 template files)
templates/subSilver/album_cat_body.tpl
templates/subSilver/album_comment_body.tpl
templates/subSilver/album_index_body.tpl
templates/subSilver/album_memberlist_body.tpl
templates/subSilver/album_personal_body.tpl
templates/subSilver/album_personal_index_body.tpl
templates/subSilver/album_search_body.tpl
templates/subSilver/album_showpage_body.tpl
#
## ---- [ FIND] ------------
#
<option value="desc">{L_DESCRIPTION}</option>
#
## ---- [ AFTER ADD ] -----------------------------------------------------------------------
#
<option value="title_desc">{L_TITLE_DESCRIPTION}</option>
#
## ---- [ SAVE FILES ] ------------------------------------------------------------------------
# Eom
|
#7 Fri 23 Mar, 2007 01:27 |
|
dilirum
Joined: March 2007
Posts: 14
|
 Re: FAP Search Multiple Fields
Artie, That friggin rocks! It works like a champ! I was beginning to think that it might be too complicated to conjure something up, but here you come and just bust it out like it's nuthin!
Thanks Artie! You rock! I owe ya' one!
|
#8 Fri 23 Mar, 2007 09:21 |
|
Artie 
Joined: January 2007
Posts: 833
Location:  Lone Star State
|
 Re: FAP Search Multiple Fields
.... but here you come and just bust it out like it's nuthin!
Would be nuthin for MG, but for me it requires some effort
Anyway, you are welcome.
|
#9 Fri 23 Mar, 2007 16:56 |
|
Mighty Gorgon 
Luca Libralato
Joined: August 2006
Posts: 7192
Location:  Borgo San Michele
|
 Re: FAP Search Multiple Fields
Would be nuthin for MG, but for me it requires some effort
Anyway, you are welcome. 
It requires some effort for me as well...
Anyway... added to standard FAP.
Thanks.
____________ Luca
SEARCH is the quickest way to get support.
Icy Phoenix ColorizeIt - CustomIcy - HON
|
#10 Tue 27 Mar, 2007 01:33 |
|
|
Page 1 of 1
|
Was this topic useful?
Was this topic useful?
Link this topic |
URL |
|
BBCode |
|
HTML |
|
You cannot post new topics You cannot reply to topics You cannot edit your posts You cannot delete your posts You cannot vote in polls You cannot attach files You can download files You cannot post calendar events
|
|
|
|