|
#1
|
|||
|
|||
|
Search Addon - here it is
ever wanted a search addon, which searches headline (title) and body (description) of your database (table pixelpost)
just add <SEARCH_BOX> where you want the searchbox and <SEARCH_RESULTS> in a new template file named search_template.php and here comes the code for search.php Code:
<?php
/*
Requires Pixelpost version 1.4 or newer
Search_ADDon 0.1
Written by: Mirko Theophil aka amalYdia
http://www.amalydia.de
Pixelpost www: http://www.pixelpost.org/
License: http://www.gnu.org/copyleft/gpl.html
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.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
============================================================================
NEW TAGS:
<SEARCH_RESULT>
<SEARCH_BOX>
*/
$addon_name = "Search (for PP v1.4)";
$addon_version = "0.1";
$addon_description = "$attention_call Simple Search ADDon for PP1.4.1 by amalydia.de";
//-------------------------------- SEARCH BOX
$search_box = "<form method='post' action='index.php?x=search' name='searchform' >
<label><input type='text' name='q' class='input' value='suche' /></label>
<input type='submit' value='GO' class='commentbutton' />";
$tpl = str_replace("<SEARCH_BOX>",$search_box,$tpl);
//-------------------------------- SEARCH FUNCTION
$query = mysql_query('SELECT * '
. ' FROM `'.$pixelpost_db_prefix.'pixelpost` '
. ' WHERE (`headline` '
. ' LIKE \'%'.$q.'%\' OR `body` '
. ' LIKE \'%'.$q.'%\') LIMIT 0, 30');
$i=0;
while( $row=mysql_fetch_array($query) )
{
$image_name = $row['image'];
$image_title = pullout($row['headline']);
$image_id = $row['id'];
$image_title = htmlspecialchars($image_title,ENT_QUOTES);
$image_thumbnail_no_link = "<img src='thumbnails/thumb_$image_name' alt='$image_title' title='$image_title' />";
$search_links .= "<a href='$showprefix$image_id'>$image_thumbnail_no_link</a>";
$i++;
}
if(!$search_links) {
$search_links = "Keine Ergebnisse zum Suchbegriff <i>".$q."</i> gefunden!<br/><br/>";
}
$tpl = str_replace("<SEARCH_RESULTS>",$search_links,$tpl);
?>
__________________
Wer das Internet zu nutzen weiß, dem gehört die Gegenwart, wer es jedoch zu verändern weiß, dem gehört die Zukunft. for sale: madcity.de |
|
#2
|
||||
|
||||
|
Did you see this topic?
http://pixelpost.org/forum/viewtopic...sc&start=0 there is already two versions of search addon. Does your search addon do similar job? what are the differences. If you can provide a more flexible search addon with combiniation of these addons, it would be great.
__________________
Photoblog: http://pblog.raminia.com Powered by Pixelpost 1.7 |
|
#3
|
|||
|
|||
|
i justr wanted to simplify the search progress and the appereance of the results.. thats why i gave this addon the version number 0.1 :-)
__________________
Wer das Internet zu nutzen weiß, dem gehört die Gegenwart, wer es jedoch zu verändern weiß, dem gehört die Zukunft. for sale: madcity.de |
|
#4
|
|||
|
|||
|
after some trial&error, I was able to get it to work!
thank you! ![]() the new file should be called search_template.html (not search_template.php) and should be placed into the /templates/your-template-name folder |
|
#5
|
||||
|
||||
|
I just dont understand the need for a search feature on a "photoblog" it sort of goes against the entire idea behind the system...
lol
__________________
i should say more clever stuff |
|
#6
|
|||
|
|||
|
well, if someone finds my blog thru google, while searching -say- Bologna pics, he'll find just one pic.
then he could search into my photoblog for "Bologna" and he finds 5 more pictures!
|
|
#7
|
||||
|
||||
|
the odds are so insanely remote though...and 95% of the photoblogs containing search features that i come across i get no results back on my query, you truly have to have a ton of content/keywords covered for this to directly benifit a visitor in any way possible.
__________________
i should say more clever stuff |
|
#8
|
|||
|
|||
|
can you get this to return keywords that are categories as well?
|
|
#9
|
|||
|
|||
|
Ideally it would be good to have an option when you upload a new image to have a field where you can enter keywords specific to that image into and it will save those, separate to the main description. And the search feature will uses that to pull out images.
|
|
#10
|
|||
|
|||
|
you don't have to make a new table-field.. just remove the description from your template and add your keaywords in this field... the field won't be shown, but will be used for search progress
__________________
Wer das Internet zu nutzen weiß, dem gehört die Gegenwart, wer es jedoch zu verändern weiß, dem gehört die Zukunft. for sale: madcity.de |
| Post Reply |
| Thread Tools | |
|
|