Customized serch.php Customized serch.php
 

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

Main Menu

Customized serch.php

Started by AK_CCM, June 25, 2006, 06:49:11 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

AK_CCM

Hello all,

I want to have a customized search-page for my CPG148 installation such as you can see at the attached search2.gif. But my 1st problem are the user fields (please look at the attached search.gif). They are grouped in $customs so I can't positioning each field in a row. How could I insert one user field per row instead of the hole group? Then I want a fixed tablewidth of the search table similar to the main table that I configured in the Coppermine settings.

Below you can find the code of my search.php (search.gif)

<?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.8
  $Source$
  $Revision: 3116 $
  $Author: gaugau $
  $Date: 2006-06-08 00:11:54 +0200 (Do, 08 Jun 2006) $
**********************************************/

define('IN_COPPERMINE'true);
define('SEARCH_PHP'true);

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

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

pageheader($lang_search_php['title']);
echo <<< EOT

<form method="post" action="thumbnails.php" name="searchcpg">
EOT;

starttable('60%'$lang_search_php['title']);

$ip GALLERY_ADMIN_MODE '
        <tr>
                <td>
                        <input type="checkbox" name="pic_raw_ip" class="checkbox" id="pic_raw_ip" /><label for="pic_raw_ip" class="clickable_option">'
.$lang_search_php['ip_address'].'</label>
                </td>
        </tr>' 
:
        
'<tr>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
        </tr>'
;

$customs '';

$result cpg_db_query("SELECT * FROM {$CONFIG['TABLE_CONFIG']} WHERE name LIKE 'user_field%_name' AND value <> '' ORDER BY name ASC");

while (
$row mysql_fetch_assoc($result)){
        
$name str_replace(array('_field''_name'), ''$row['name']);
        
$customs .= <<< EOT
                <tr>
                        <td><input type="checkbox" name="
$name" id="$name" class="checkbox" /><label for="$name" class="clickable_option">{$row['value']}</label></td>
                </tr>
EOT;
}
echo <<< EOT
        <tr>
            <td class="tableb" align="center" >
                <input type="text" style="width: 80%" name="search" maxlength="255" value="" class="textinput" />
                <input type="submit" value="
{$lang_search_php['submit_search']}" class="button" />
                <input type="hidden" name="album" value="search" />
            </td>
        </tr>
                <tr>
                        <td class="tableb">
                                <table align="center" width="60%">
                                        <tr>
                                                <td>
{$lang_search_php['fields']}:</td>
                                                <td align="center">
{$lang_search_php['age']}:</td>
                                        </tr>
                                        <tr>
                                                <td><input type="checkbox" name="title" id="title" class="checkbox" checked="checked" /><label for="title" class="clickable_option">
{$lang_adv_opts['title']}</label></td>
                                                <td align="right">
{$lang_search_php['newer_than']} <input type="text" name="newer_than" size="3" maxlength="4" class="textinput" /> {$lang_search_php['days']}</td>
                                        </tr>
                                        <tr>
                                                <td><input type="checkbox" name="caption" id="caption" class="checkbox" checked="checked" /><label for="caption" class="clickable_option">
{$lang_adv_opts['caption']}</label></td>
                                                <td align="right">
{$lang_search_php['older_than']} <input type="text" name="older_than" size="3" maxlength="4" class="textinput" /> {$lang_search_php['days']}</td>
                                        </tr>
                                        <tr>
                                                <td><input type="checkbox" name="keywords" id="keywords" class="checkbox" checked="checked" /><label for="keywords" class="clickable_option">
{$lang_adv_opts['keywords']}</label></td>
                                                <td>&nbsp;</td>

                                        </tr>
                                        <tr>
                                                <td><input type="checkbox" name="owner_name" id="owner_name" class="checkbox" /><label for="owner_name" class="clickable_option">
{$lang_adv_opts['owner_name']}</label></td>
                                                <td align="right"><select name="type" class="listbox">
                                                        <option value="AND" selected="selected">
{$lang_search_php['all_words']}</option>
                                                        <option value="OR">
{$lang_search_php['any_words']}</option></select>
                                                </td>
                                        </tr>
                                        <tr>
                                                <td><input type="checkbox" name="filename" id="filename" class="checkbox" /><label for="filename" class="clickable_option">
{$lang_adv_opts['filename']}</label></td>
                                                <td>&nbsp;</td>
                                        </tr>
                                                
$customs
                                                
$ip
                                </table>
                        </td>
                </tr>
EOT;


endtable();
echo 
'</form>';

if (
$CONFIG['clickable_keyword_search'] != 0) {
    include(
'include/keyword.inc.php');
}

echo <<< EOT
      <script language="javascript" type="text/javascript">
      <!--
      document.searchcpg.search.focus();
      -->
      </script>
EOT;

pagefooter();
ob_end_flush();
?>



Could anyone help me please?

Regards, AK

AK_CCM

Hello again,

I've tried to insert the code

<input type="checkbox" name="user1" class="checkbox" id="user1" /><label for="user1" class="clickable_option">{$lang_search_php['user1']}</label>


into search.php. Now the search function with this field works great, but the name of the user1-field won't be displayed on the screen. only the checkbox is shown:

http://www.pilze-augsburg.de/galerie/search2.php

What's wrong?

Regards, AK

Sami

you should add 'user1' and its value to lang file under $lang_search_php array
the $lang_search_php under english lang file should be look like this:

$lang_search_php = array(
  'title' => 'Search the file collection', //cpg1.4
  'submit_search' => 'search', //cpg1.4
  'keyword_list_title' => 'Keyword list', //cpg1.4
  'keyword_msg' => 'The above list is not all inclusive. It does not include words from photo titles or descriptions. Try a full-text search.',  //cpg1.4
  'edit_keywords' => 'Edit keywords', //cpg1.4
  'search in' => 'Search in:', //cpg1.4
  'ip_address' => 'IP address', //cpg1.4
  'fields' => 'Search in', //cpg1.4
  'age' => 'Age', //cpg1.4
  'newer_than' => 'Newer than', //cpg1.4
  'older_than' => 'Older than', //cpg1.4
  'days' => 'days', //cpg1.4
  'all_words' => 'Match all words (AND)', //cpg1.4
  'any_words' => 'Match any words (OR)', //cpg1.4
  'user1'=>'user name', //moded for Customized shearch
);

also you should change your other lang file (german or ....)
‍I don't answer to PM with support question
Please post your issue to related board

AK_CCM

Hello bmossavari,

thank you for helping - now it works great:
http://www.pilze-augsburg.de/galerie/search.php

Regards, AK

Sami

it's ok under german language but it's better if you add that to english.php too
‍I don't answer to PM with support question
Please post your issue to related board

AK_CCM

The file informations and the rest of our homepage are in german language.
Why should I make the changes in english.php too?

Sami

it's okey if you don't target english user
‍I don't answer to PM with support question
Please post your issue to related board