Merge pull request #1602 from rabuzarus/searchbox

template for searchbox
This commit is contained in:
fabrixxm 2015-05-24 20:44:45 +02:00
commit dc182d508e
2 changed files with 20 additions and 10 deletions

View File

@ -960,19 +960,18 @@ if(! function_exists('search')) {
* @param string $s search query * @param string $s search query
* @param string $id html id * @param string $id html id
* @param string $url search url * @param string $url search url
* @param boolean $save show save search button * @param boolean $savedsearch show save search button
* @return string html for search box #FIXME: remove html
*/ */
function search($s,$id='search-box',$url='/search',$save = false) { function search($s,$id='search-box',$url='/search',$save = false) {
$a = get_app(); $a = get_app();
$o = '<div id="' . $id . '">'; return replace_macros(get_markup_template('searchbox.tpl'), array(
$o .= '<form action="' . $a->get_baseurl((stristr($url,'network')) ? true : false) . $url . '" method="get" >'; '$s' => $s,
$o .= '<input type="text" name="search" id="search-text" placeholder="' . t('Search') . '" value="' . $s .'" />'; '$id' => $id,
$o .= '<input type="submit" name="submit" id="search-submit" value="' . t('Search') . '" />'; '$action_url' => $a->get_baseurl((stristr($url,'network')) ? true : false) . $url,
if($save) '$search_label' => t('Search'),
$o .= '<input type="submit" name="save" id="search-save" value="' . t('Save') . '" />'; '$save_label' => t('Save'),
$o .= '</form></div>'; '$savedsearch' => feature_enabled(local_user(),'savedsearch'),
return $o; ));
}} }}
if(! function_exists('valid_email')) { if(! function_exists('valid_email')) {

View File

@ -0,0 +1,11 @@
<div id="{{$id}}" class="input-group">
<form action="{{$action_url}}" method="get" >
{{strip}}
<input type="text" name="search" id="search-text" placeholder="{{$search_label}}" value="{{$s}}" />
<input type="submit" name="submit" id="search-submit" value="{{$search_label}}" />
{{if $savedsearch}}
<input type="submit" name="searchsave" id="search-save" value="{{$save_label}}" />
{{/if}}
{{/strip}}
</form>
</div>