Add shortcut search bar MOD Add shortcut search bar MOD
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Add shortcut search bar MOD

Started by carefree, August 01, 2007, 02:09:21 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

carefree

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!

Joachim Müller

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<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:<?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).

carefree

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

Joachim Müller

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.