template for searchbox

This commit is contained in:
rabuzarus 2015-05-24 20:01:08 +02:00
parent f32ecd4012
commit b3054ee9d0
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>