1
0
Fork 0

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