Hello Mike,

Wednesday, January 7, 2015, 2:12:40 PM, you wrote:

> How can I set up a box where anyone can enter the name they want to
> search for and it will carry out the search for that name.

This is adapted from a standard wiki search box, but customised to act
on flickr:

try  this  custom  searchbox markup in  your  wiki  page  (the  W  parameter
corresponds to your flickr scout account I think):

(:flickrsearchbox w=96679687@N02:)


put this code into config.php:

## custom Flickr searchbox (:flickrsearchbox:)
function FlickrSearchBox($pagename, $opt) {
  global $SearchBoxOpt, $SearchQuery, $EnablePathInfo;
 SDVA($SearchBoxOpt, array(
    'size'   => '20', 
    'label'  => FmtPageName('$[Search Flickr]', $pagename),
    'value'  => str_replace("'", "'", $SearchQuery)));
 $opt = array_merge((array)$SearchBoxOpt, (array)$opt);
 $focus = $opt['focus'];
 $opt['action'] = 'search';
 if($opt['target']) $target = MakePageName($pagename, $opt['target']); 
 else $target = $pagename;
 $out = "<form  class='wikisearch' action='http://www.flickr.com/search/' 
method='get'>";
 $out .= "<input type='text' name='q' value='{$opt['value']}' class='inputbox 
searchbox' size='{$opt['size']}' ";
        if ($focus) $out .= " onfocus=\"if(this.value=='{$opt['value']}') 
this.value=''\" onblur=\"if(this.value=='') this.value='{$opt['value']}'\" ";
 $out .= " /><input type='submit' class='inputbutton searchbutton' 
value='{$opt['label']}' />";
 foreach($opt as $k => $v) {
   if ($v == '' || is_array($v)) continue;
   if ($k=='q' || $k=='label' || $k=='value' || $k=='size') continue;
   $k = str_replace("'", "&#039;", $k);
   $v = str_replace("'", "&#039;", $v);
   $out .= "<input type='hidden' name='$k' value='$v' />";
 }
 return Keep($out)."</form>";
}
Markup_e('flickrsearchbox', '>links',
  '/\\(:flickrsearchbox(\\s.*?)?:\\)/',
  "FlickrSearchBox(\$pagename, ParseArgs(\$m[1]))");



Best regards,
 Hans                         
mailto:[email protected]
www.softflow.co.uk


_______________________________________________
pmwiki-users mailing list
[email protected]
http://www.pmichaud.com/mailman/listinfo/pmwiki-users

Reply via email to