forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: carefree on August 01, 2007, 02:09:21 pm

Title: Add shortcut search bar MOD
Post by: carefree 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!
Title: Re: Add shortcut search bar MOD
Post by: Joachim Müller 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? (http://forum.coppermine-gallery.net/index.php?topic=28097.0)" or "Wie mache ich die Suchfunktion immer sichtbar? (http://forum.coppermine-gallery.net/index.php?topic=26966.0)" (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:

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).
Title: Re: Add shortcut search bar MOD
Post by: carefree 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
Title: Re: Add shortcut search bar MOD
Post by: Joachim Müller 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.