Pixelpost

Authentic Photoblog Flavour


Go Back   Pixelpost Forum > DEVELOPMENT > Addons

Post Reply
 
Thread Tools
  #1  
Old 05-28-2005, 02:35 AM
amalydia Offline
pp regular
 
Join Date: May 2005
Location: Bernburg, Germany
Posts: 21
Send a message via ICQ to amalydia
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
Reply With Quote
  #2  
Old 05-28-2005, 07:32 AM
raminia's Avatar
raminia+ Offline
Team Pixelpost
 
Join Date: Jan 2005
Location: FL, US
Posts: 3,706
Send a message via Yahoo to raminia
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
Reply With Quote
  #3  
Old 05-28-2005, 11:40 AM
amalydia Offline
pp regular
 
Join Date: May 2005
Location: Bernburg, Germany
Posts: 21
Send a message via ICQ to amalydia
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
Reply With Quote
  #4  
Old 05-28-2005, 09:39 PM
steff Offline
pixelpost guru
 
Join Date: Feb 2005
Location: Milan, Italy
Posts: 151
Send a message via MSN to steff
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
Reply With Quote
  #5  
Old 05-28-2005, 10:06 PM
blinking8s's Avatar
blinking8s+ Offline
über loafer
 
Join Date: Oct 2004
Location: Bowling Green, Ky
Posts: 3,428
Send a message via ICQ to blinking8s Send a message via AIM to blinking8s Send a message via MSN to blinking8s Send a message via Skype™ to blinking8s
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
Reply With Quote
  #6  
Old 05-28-2005, 10:30 PM
steff Offline
pixelpost guru
 
Join Date: Feb 2005
Location: Milan, Italy
Posts: 151
Send a message via MSN to steff
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!
Reply With Quote
  #7  
Old 05-28-2005, 10:39 PM
blinking8s's Avatar
blinking8s+ Offline
über loafer
 
Join Date: Oct 2004
Location: Bowling Green, Ky
Posts: 3,428
Send a message via ICQ to blinking8s Send a message via AIM to blinking8s Send a message via MSN to blinking8s Send a message via Skype™ to blinking8s
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
Reply With Quote
  #8  
Old 05-29-2005, 05:49 PM
ctranter Offline
pp regular
 
Join Date: Apr 2005
Posts: 44
can you get this to return keywords that are categories as well?
Reply With Quote
  #9  
Old 05-29-2005, 05:52 PM
ctranter Offline
pp regular
 
Join Date: Apr 2005
Posts: 44
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.
Reply With Quote
  #10  
Old 05-30-2005, 07:01 AM
amalydia Offline
pp regular
 
Join Date: May 2005
Location: Bernburg, Germany
Posts: 21
Send a message via ICQ to amalydia
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
Reply With Quote
Post Reply


Thread Tools




All times are GMT. The time now is 09:23 PM.

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd. | Style Design: d3 designs