mirror of
https://github.com/openresty/openresty.git
synced 2024-10-13 00:29:41 +00:00
checked in mising files in the blog demo.
This commit is contained in:
51
demo/Blog/template/elem/pager.tt
Normal file
51
demo/Blog/template/elem/pager.tt
Normal file
@ -0,0 +1,51 @@
|
||||
[% DEFAULT
|
||||
page = 1,
|
||||
page_count = undef,
|
||||
title = 'Pages',
|
||||
prefix = 'post-list/',
|
||||
suffix = ''
|
||||
-%]
|
||||
|
||||
[% IF page_count <= 10;
|
||||
from = 1;
|
||||
to = page_count;
|
||||
ELSE;
|
||||
from = page - 10 >= 1 ? page - 10 : 1
|
||||
to = page + 9 >= page_count ? page_count : page + 9;
|
||||
END -%]
|
||||
|
||||
<center>
|
||||
<table class="paging">
|
||||
<tr>
|
||||
<td>
|
||||
[% title %]:
|
||||
</td>
|
||||
<td>
|
||||
[%- IF page > 1 %]
|
||||
<span class="prev-page">
|
||||
<a href="#[% prefix _ (page - 1) _ suffix %]">Previous</a>
|
||||
</span>
|
||||
[%- END %]
|
||||
</td>
|
||||
|
||||
[%- i = from; %]
|
||||
[%- WHILE i <= to %]
|
||||
[%- IF i == page %]
|
||||
<td class="highlight">[% i %]</td>
|
||||
[%- ELSE %]
|
||||
<td><a href="#[% prefix _ i _ suffix %]">[% i %]</a></td>
|
||||
[%- END %]
|
||||
[%- i = i + 1 %]
|
||||
[%- END %]
|
||||
|
||||
<td>
|
||||
[%- IF page < page_count %]
|
||||
<span class="next-page">
|
||||
<a href="#[% prefix _ (page + 1) _ suffix %]">Next</a>
|
||||
</span>
|
||||
[%- END %]
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
<br/>
|
Reference in New Issue
Block a user