[pmwiki-users] 9th Braid (George Watson's College) Scout Group
Hans Bracker
design at softflow.co.uk
Wed Jan 7 09:23:21 CST 2015
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 at 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("'", "'", $k);
$v = str_replace("'", "'", $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:design at softflow.co.uk
www.softflow.co.uk
More information about the pmwiki-users
mailing list