Icy Phoenix

     
 


This forum is locked: you cannot post, reply or edit topics.  This topic is locked: you cannot edit posts or make replies. 
Page 1 of 1
 
 
Reply with quote Download Post 
Post 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.
 



 
dilirumSend private message  
Back to topPage bottom
Icy Phoenix is an open source project, you can show your appreciation and support future development by donating to the project.

Support us
 
Reply with quote Download Post 
Post Re: FAP Search Multiple Fields 
 
dilirum wrote: [View Post]
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
 
Mighty GorgonSend private messageSend e-mail to userVisit poster's website  
Back to topPage bottom
Reply with quote Download Post 
Post Re: FAP Search Multiple Fields 
 
Thanks for the reply.

Anyone?
 



 
dilirumSend private message  
Back to topPage bottom
Reply with quote Download Post 
Post 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?
 



 
dilirumSend private message  
Back to topPage bottom
Reply with quote Download Post 
Post Re: FAP Search Multiple Fields 
 
I gues you could have a try modifying album_search.php in some way like this...

Code: [Download] [Hide]
  1. 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
 
Mighty GorgonSend private messageSend e-mail to userVisit poster's website  
Back to topPage bottom
Reply with quote Download Post 
Post 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.
 



 
dilirumSend private message  
Back to topPage bottom
Reply with quote Download Post 
Post Re: FAP Search Multiple Fields 
 
This may get you close to what you're lookin for.

Code: [Download] [Hide] [Select]

#
## ---- [ 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



 



 
ArtieSend private message  
Back to topPage bottom
Reply with quote Download Post 
Post 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!  
 



 
dilirumSend private message  
Back to topPage bottom
Reply with quote Download Post 
Post Re: FAP Search Multiple Fields 
 
dilirum wrote: [View Post]
.... 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.
 



 
ArtieSend private message  
Back to topPage bottom
Reply with quote Download Post 
Post Re: FAP Search Multiple Fields 
 
Artie wrote: [View Post]
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
 
Mighty GorgonSend private messageSend e-mail to userVisit poster's website  
Back to topPage bottom
This forum is locked: you cannot post, reply or edit topics.  This topic is locked: you cannot edit posts or make replies.  Page 1 of 1
 


Display posts from previous:    

HideWas this topic useful?

Link this topic
URL
BBCode
HTML




 
Permissions List
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


  

 

  cron