templatise alt_pager

This commit is contained in:
friendica 2013-06-03 18:16:00 -07:00
parent 1f94429b2c
commit b866cc26fa
4 changed files with 15 additions and 15 deletions

View File

@ -334,20 +334,16 @@ function alt_pager(&$a, $i, $more = '', $less = '') {
$pagenum = $a->pager['page'];
$url = $a->get_baseurl() . '/' . $stripped;
$o .= '<div class="pager">';
return replace_macros(get_markup_template('alt_pager.tpl'),array(
'$has_less' => (($a->pager['page'] > 1) ? true : false),
'$has_more' => (($i > 0 && $i == $a->pager['itemspage']) ? true : false),
'$less' => $less,
'$more' => $more,
'$url' => $url,
'$prevpage' => $a->pager['page'] - 1,
'$nextpage' => $a->pager['page'] + 1,
));
if($a->pager['page'] > 1)
$o .= "<a href=\"$url"."&page=".($a->pager['page'] - 1).'">' . $less . '</a>';
if($i > 0 && $i == $a->pager['itemspage']) {
if($a->pager['page']>1)
$o .= " | ";
$o .= "<a href=\"$url"."&page=".($a->pager['page'] + 1).'">' . $more . '</a>';
}
$o .= '</div>'."\r\n";
return $o;
}
// Turn user/group ACLs stored as angle bracketed text into arrays

View File

@ -2,7 +2,7 @@
/**
*
* Friendica Red
* Red Matrix
*
*/

View File

@ -166,7 +166,7 @@ function directory_content(&$a) {
));
$o .= alt_pager($a,$j['records'], t('more'), t('back'));
$o .= alt_pager($a,$j['records'], t('next page'), t('previous page'));
}
else {

4
view/tpl/alt_pager.tpl Normal file
View File

@ -0,0 +1,4 @@
<div class="pager">
{{if $has_less}}<a href="{{$url}}&page={{$prevpage}}" class="pager-prev">{{$less}}</a>{{/if}}
{{if $has_more}}{{$if $has_less}}&nbsp;|&nbsp;{{/if}}<a href="{{$url}}&page={{$nextpage}}" class="pager-next">{{$more}}</a>{{/if}}
</div>