Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: Search By Category  (Read 6447 times)

0 Members and 1 Guest are viewing this topic.

will

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 263
Search By Category
« on: March 21, 2007, 07:47:45 pm »

I was wondering weather anybody can help me on adding a search field on the main page with search by category or all categories, I mean adding a drop down menu where a member can select which category they want to search or select 'all categorys'

attached both images to show which ways I would like this search to work

Hope you understand

Thanks ;D
« Last Edit: July 12, 2007, 09:07:22 pm by GauGau »
Logged

will

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 263
Re: Search By Category
« Reply #1 on: March 24, 2007, 05:56:08 pm »

anybody ???
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Search By Category
« Reply #2 on: March 25, 2007, 09:02:49 pm »

It's pretty easy to come up with a search field on all pages that does the same thing the regular coppermine search page does. Searching by category isn't implemented in Coppermine's core though, so this is not a matter of coming up with the search form, but with a page that does the queries and comes up with the results. This is not a trivial task (in other words: this would require some coding skills and some time to actually code this). In my opinion this is beyond the scope of what you can expect from free support - it would more be a case for a paid customization request. That's probably the reason why nobody answered: there is no simple solution, and nobody is willing to look into this in detail.
If you're willing to pay for this, then read the sticky thread "sub-board rules, read first!" on the paid support board and do as suggested there (posting your budget and schedule). A moderator will then move this thread if applicable.
« Last Edit: March 26, 2007, 07:50:55 am by GauGau »
Logged

will

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 263
Re: Search By Category
« Reply #3 on: March 25, 2007, 11:28:45 pm »

ok, thanks gaugau ;D
Logged

will

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 263
Search Customization On Main Page
« Reply #4 on: March 25, 2007, 11:47:31 pm »

I'm currently looking for someone to do me a customization of the search in coppermine on the main page with a drop down bar so users can select which category to search in or search in all categories.

I have a budget of £10-£20, if you think this not enough I'm willing to go to £25

I have also attached two pics to show what I need doing, taken from another site I use

Any help will be great ;D
« Last Edit: March 26, 2007, 08:06:11 am by GauGau »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Search By Category
« Reply #5 on: March 26, 2007, 08:05:47 am »

I suggested to reply to the existing thread. That's why I told you that a moderator would move the thread if applicable. You were not suppossed to start a new thread, especially since the new thread you started will not explain to potential takers what the catch is. That's why I merged both threads into this one and stripped the attachments of your second posting.
Logged

SaWey

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1119
    • SaWey.be
Re: Search By Category
« Reply #6 on: March 26, 2007, 07:20:04 pm »

I've begun some coding around this feature in the past, but I have no time to finish this.

If someone want to use it....

Code: [Select]
<?php
/*************************
  Coppermine Photo Gallery
  ************************
  Copyright (c) 2003-2006 Coppermine Dev Team
  v1.1 originally written by Gregory DEMAR

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.
  ********************************************
  Coppermine version: 1.4.10
  $Source$
  $Revision: 1 $
  $Author: SaWey $
  Parts of this script where borrowed from the searchnew.php file written by gaugau.
  $Date: 2006-11-26 01:52:21  $
**********************************************/
define('IN_COPPERMINE'true);
define('SEARCH_PHP'true);
define('INDEX_PHP'true);

require(
'include/init.inc.php');

if (!
USER_ID && $CONFIG['allow_unlogged_access'] == 0) {
$redirect $redirect "login.php";
header("Location: $redirect");
exit();
}

if (isset(
$_POST['search'])){
search();
}else{
start();
}

function 
start(){

$cat_array = array();
getallcatsindb($cat_array);


/**
*Create the select box
*/
$form '
<form name="searchcpg" method="post" action="">
<input type="text" name="search" class="textinput"/>
<input type="hidden" name="album" value="search" />
<input type="hidden" name="title" value="title" />
<input type="hidden" name="caption" value="caption" />
<input type="hidden" name="keywords" value="keywords" />
<input type="hidden" name="owner_name" value="owner_name" />
<input type="hidden" name="filename" value="filename" />
<select name="album" size="1">
'
;
foreach($cat_array as $cat => $arr){
$form .= ' <option value="cat_' $cat '">'.$arr['name'].'</option>';
foreach($arr['albums'] as $key => $album){
$form .= ' <option value="alb_' $key '">&nbsp;&nbsp;&nbsp;- '.$album.'</option>';
}
}
$form .= '</select>';
$form .= '&nbsp;<input type="submit" value="' 'Search" />';//$lang_search_php['submit_search'] . '" />';
$form .= '</form>';
print($form);
}

function 
search(){

$album $_POST['album'];
if(substr($album,0,3)=="alb"){
//search in album
$album substr($album,4);

}else{
//search in category
$category substr($album,4);

}


}

/**
 * getallcatsindb()
 *
 * Fill an array with all albums where keys are aid of albums and values are
 * album title
 *
 * @param  $cat_array the array to be filled
 * @return
 */
function getallcatsindb(&$cat_array)
{
    global 
$CONFIG;

    
$cats_sql "SELECT cid, name " "FROM {$CONFIG['TABLE_CATEGORIES']} " "WHERE 1";
    
$cats_result cpg_db_query($cats_sql);

    while (
$cats_row mysql_fetch_array($cats_result)) {
        
$cat_array[$cats_row['cid']]['name'] = $cats_row['name'];
$cid $cats_row['cid'];
$album_sql "SELECT aid, title " "FROM {$CONFIG['TABLE_ALBUMS']} " "WHERE 1 AND category='$cid'";
//print($album_sql);
$album_result cpg_db_query($album_sql);

while ($album_row mysql_fetch_array($album_result)) {
$cat_array[$cats_row['cid']]['albums'][$album_row['aid']]=$album_row['title'];
}
mysql_free_result($album_result);
    }
    
mysql_free_result($cats_result);
}
?>

Logged

will

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 263
Re: Search By Category
« Reply #7 on: March 26, 2007, 10:25:33 pm »

@GauGau: Sorry I didn't read the reply from you properly

@SaWey: Thanks for the code this will be great for whoever will take this request

If anyone can help, please email me and I will send the relevant files needed ;D
Logged

will

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 263
Re: Search By Category
« Reply #8 on: March 29, 2007, 07:15:25 pm »

Is there anybody willing to help, need this doing a.s.a.p.

Anybody interested let me know ;D
Logged

will

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 263
Re: Search By Category
« Reply #9 on: May 09, 2007, 05:52:32 pm »

Still need someone to help me on this and take this request

Please email me will.taka05@googlemail.com for info ;D
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Search By Category
« Reply #10 on: May 10, 2007, 08:08:53 am »

It is not advisable to post your email address in your thread - this will only make email harvesters store your email address, resulting in even more spam. Just enable notifictions for the thread you start instead. You'll be emailed then if potential job takers reply to your thread.
Logged
Pages: [1]   Go Up
 

Page created in 0.022 seconds with 20 queries.