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: Add shortcut search bar MOD  (Read 3795 times)

0 Members and 1 Guest are viewing this topic.

carefree

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 32
Add shortcut search bar MOD
« on: August 01, 2007, 02:09:21 pm »

Add this to your template or anycontent.php and youll have a search bar anywhere you want.

See it live here : http://www.freexxxhunters.com/all //WARNING NOT WORK SAFE//

Ive found that by naming your pics before uploading, you dont have to add keywords to every single pic. Just a little time saver

Quote
<form method="post" action="thumbnails.php" name="searchcpg">
<table align="center" width="60%" cellspacing="1" cellpadding="0" class="maintable">
             <tr>
            <td align="center" bgcolor="#FFFFFF" >
                <font size="2">
<b><font color="#000000" size="3">
                <input type="text" style="width: 184; height:25" name="search" maxlength="255" value="" class="textinput" /></font></b></font>
                <input type="submit" value="Search" class="button" />
                <input type="hidden" name="album" value="search" />
               </td>
        </tr>
                <tr> 
 <input type="hidden" name="title" id="title" class="checkbox" checked="checked" /><label for="title" class="clickable_option"></label> 
 <input type="hidden" name="caption" id="caption" class="checkbox" checked="checked" /><label for="caption" class="clickable_option"></label>
 <input type="hidden" name="keywords" id="keywords" class="checkbox" checked="checked" /><label for="keywords" class="clickable_option"></label>
 </tr></form>

Enjoy!
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Add shortcut search bar MOD
« Reply #1 on: August 01, 2007, 06:03:05 pm »

Thanks for sharing your solution. Has been posted already though, see "HTML to put search field on regular web page?" or "Wie mache ich die Suchfunktion immer sichtbar?" (German).
You don't necessarily have to use the code on Coppermine-driven pages - you can even use it on non-coppermine driven pages as well (just make sure to change the action attribute of the <form>-tag to reflect the location of the target file).
 
There are some minor corrections:
  • you will of course not need labels for hidden fields nor do hidden fields need a style, although they need a value of course if they are suppossed to make sense
  • you should avoid deprecated HTML formatting like the notorious <font>-tag like the plague
  • you shouldn't use the same name for the form field to avoid collisions with the original form

So your search form should actually be something like this
Code: [Select]
<form method="post" action="thumbnails.php" name="custom_search">
<input type="text" name="search" maxlength="255" value="" class="textinput" />
<input type="submit" value="Search" class="button" />
<input type="hidden" name="album" value="search" />
<input type="hidden" name="title" value="1" />
<input type="hidden" name="caption" value="1" />
<input type="hidden" name="keywords" value="1" />
<input type="hidden" name="owner_name" value="1" />
<input type="hidden" name="filename" value="1" />
<input type="hidden" name="type" value="AND" />
</form>
Doesn't qualify as an actual mod imo - after all, you just copy the ouput of the search field and pasted it in - no particular magic in this.

In an even better attempt, display your custom search field on all pages but the actual search page. Just wrap the whole enchilada into a simple if/then contruct (using PHP) to determine what page you are on:
Code: [Select]
<?php
if ($_SERVER['PHP_SELF'] != 'search.php') {
print <<< EOT
<form method="post" action="thumbnails.php" name="custom_search">
<input type="text" name="search" maxlength="255" value="" class="textinput" />
<input type="submit" value="Search" class="button" />
<input type="hidden" name="album" value="search" />
<input type="hidden" name="title" value="1" />
<input type="hidden" name="caption" value="1" />
<input type="hidden" name="keywords" value="1" />
<input type="hidden" name="owner_name" value="1" />
<input type="hidden" name="filename" value="1" />
<input type="hidden" name="type" value="AND" />
</form>
EOT;
}
?>
Above code snippet could be used in anycontent.php or theme.php, but not in template.html (as PHP code can't go into template.html).
Logged

carefree

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 32
Re: Add shortcut search bar MOD
« Reply #2 on: August 02, 2007, 01:14:02 am »

Yeah not reallly a MOD just a realization you can actually do that :)

Although I have just finished another voting MOD, its on the same page. Let me know if its already been posted, if it hasnt ill make a lame attempt to make it a plugin. Its very polpular and easy to use so should make a nice addition
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Add shortcut search bar MOD
« Reply #3 on: August 02, 2007, 07:40:18 am »

Please start a new thread, posting the code that you already have together with a description what it does. We can then determine together if it makes sense to turn the mod into a plugin.
Logged
Pages: [1]   Go Up
 

Page created in 0.023 seconds with 19 queries.