macro.vm
1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
## 面包屑
## $c 为列表变量值
## "首页:/home,列表页:/list,详情页"
#macro(crumbs $c)
#set($list=$!{webUtils.getCrumbsByString($c)})
#set($index=0)
#foreach($elem in $list)
<li>
#if($index == 0)
<i class="icon-home home-icon"></i>
#end
#set($title = "")
#set($url = "")
#set($j=0)
#foreach($val in $elem)
#if($j==0)
#set($title=$val)
#else
#set($url=$val)
#end
#set($j=$j+1)
#end
<a href="$!{url}">$!{title}</a>
</li>
#set($index=$index+1)
#end
#end
## 统一分页
## $total 总页数
## $curr 当前页数
#macro(page $total $curr)
<ul class="pagination">
#set($isFirst=$curr+1 == 1)
#set($isLast=$curr+1 == $total)
<li class="prev #if($isFirst)disabled#end">
#set ( $tmpCurr = $curr - 1 )
<a href="#if($isFirst)javascript:void(0)#else javascript:page(${tmpCurr})#end">
<i class="fa fa-angle-double-left"></i>
</a>
</li>
#foreach($index in $!{webUtils.pageSplit($curr,$total,6)})
#set( $i = $index - 1 )
<li #if($index == $curr+1)class="active" #end><a href="javascript:page($i)">$index</a></li>
#end
<li class="next #if($isLast || $total==0)disabled#end">
#set ( $tmpCurr = $curr + 1 )
<a href="#if($isLast || $total==0)javascript:void(0)#else javascript:page(${tmpCurr})#end">
<i class="fa fa-angle-double-right"></i>
</a>
</li>
</ul>
#end
## 显示数量的下拉选择
## $currCount : 当前显示的数量
#macro(selectCount $currCount)
<select name="pageSize">
#foreach($count in [1,5,10,20,50,100])
<option value="$count" #if($count == $currCount)selected#end>$count</option>
#end
</select>
#end
#macro(productdetail $pk)
http://www.diligrp.com/product/$!{pk}.html
#end
#macro(noescape $value)
#if($!{value.length()} > 0)#set($html="noescape/" + $!{value} )$!html#end
#end