-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjstpl.demo.1.4.html
112 lines (98 loc) · 7.88 KB
/
jstpl.demo.1.4.html
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf8" />
<!--SERVER_SIDE_SETTINGS-->
</head>
<body><!-- contents of the body will be parsed and compiled by JSTpl -->
<!-- <a></a> --><a name="firsta"></a>
{include file="$pageheader"}
{include file="$model"}
{$i=Math.random()}
{var $jstr='this is a j string'}
<span>call a built-in func:
{$jstr.substring(0, 12)}
</span>
{while $i<10}
<li> line {$i} </li>
{$i++}
{/while}
<span> try to call a func named 'aFunc':
{$aFunc($i)}
</span>
<span> try to list an associative list:
{for (var $k in $userlist)}
<li>Id:{$userlist[$k]['id']}, Name:{$userlist[$k]['name']}</li>
{/for}
</span>
<span> 2nd, try to list an associative list:
{for var $k in $userlist}
<li>Id:{$userlist[$k]['id']}, Name:{$userlist[$k]['name']}</li>
{/for}
</span>
<span> 3rd, try to list an associative list:
{foreach $userlist as $k}
<li onclick="javascript:bFunc('{$k}');">{$k} Id:{$userlist[$k]['id']}, Name:{$userlist[$k]['name']}</li>
{/foreach}
</span>
<script>
if(1==1){
console.log("additional original scripts before jsondata will be invoked twice....."
+ (new Date()));
}
</script>
{include content="$pagefooter"}
<!-- JSTpl json data, content below this line will not be parsed by JSTpl -->
<div id="jstpljsondata">
{
"pagetitle": "-吉娃, GWA2 JTMPL-",
"newslist": {
"0": {"title":"虾青素是目前为止最具创新、最具抗氧化能力的抗氧化剂", "href":"#11"},
"1": {"title":"所有产品都含有天然雨生红球藻(富含天然虾青素)", "href":"#10"},
"2": {"title":"更高生物利用度(更好更快被吸收)、高活性成分、不刺激肠胃", "href":"#9"},
"3": {"title":"真是极好的西红柿产品", "href":"#8"}
},
"copyright_year": 2017,
"keywords": "Wadelau, GWA2, gwa2",
"newslist_nextpage": "https://ufqi.com/#newlist_nextpage_value",
"newscontentlist":{
"0":{"title":"虾青素是目前为止最具创新、最具抗氧化能力的抗氧化剂1", "content":"111BoP S.L. 联合巴塞罗那大学健康医学实验室共同研发近百种天然健康营养品,我 们的研发人员有着二十多年营养与药剂开发经验,产品品牌在欧洲拥有极高的知 名度和美誉度。为了满足消费者“选择最佳天然营养品的健康需求”", "pages":3},
"1":{"title":"最具抗氧化能力的抗氧化剂2", "content":"222BoP S.L. 联合巴塞罗那大学健康医学实验室共同研发近百种天然健康营养品,我 们的研发人员有着二十多年营养与药剂开发经验,产品品牌在欧洲拥有极高的知 名度和美誉度。为了满足消费者“选择最佳天然营养品的健康需求”", "pages":3},
"2":{"title":"巴塞罗那大学健康医学实验室共同研发近百种天然健康营养品", "content":"333BoP S.L. 联合,我 们的研发人员有着二十多年营养与药剂开发经验,产品品牌在欧洲拥有极高的知 名度和美誉度。为了满足消费者“选择最佳天然营养品的健康需求”", "pages":2}
},
"user": {
"feedback": 2,
"iname": {"surname":"Wadelau", "familyname":"Lau"},
"age": "33"
},
"userlist": {
"usera": {"id":1234, "name":"Alice张"},
"userb": {"id": 4567, "name":"Bob李"}
},
"atag": "Xenxin\"s Tag",
"pageheader":"<div id=\"header\"> <div class=\"h_box\"> <div class=\"logo\"><a href=\"index.html\">a logo</a></div> <div class=\"menu\"> <ul> <li><a href=\"index.html\">首页</a></li> <li><a href=\"about_us.html\">关于我们</a> <div class=\"submenu\"> <ul> <li class=\"title\"><a href=\"about_us.html\">公司介绍</a></li> <li class=\"title\"><a href=\"about_us_2.html\">品牌介绍</a></li> <li class=\"title\"><a href=\"about_us_3.html\">品牌VIDEO</a></li> </ul> </div> </li> <li><a href=\"products.html\">产品中心</a></li> <li><a href=\"news.html\" class=\"active\">新闻媒体</a></li> <li><a href=\"active.html\">品牌活动</a></li> <li><a href=\"faq.html\">营养咨询</a></li> <li><a href=\"sale.html\">售卖专柜</a></li> <li><a href=\"shop.html\">网络商城</a></li> </ul> </div> </div> <div class=\"clear\"></div> </div>",
"model":"<div class=\"news\"> <div class=\"title\">最新新闻</div> <div class=\"content\"> <ul class=\"cont\" tpldata=\"newslist::repeat::\"> {for (var $k in $newslist)} <li><a class=\"btn_show\" href=\"{$newslist[$k]['href']}\">> {$newslist[$k]['title']} <a name=\"atag\" tpldata=\"atag::updatevalue\">{$newslist[$k]['title']}</a> </a> {if $newslist[$k]['title'].length > 15 } <span>Length is too long!</span> {else} <span>Length is okay.</span> {/if} </li> {/for} <!-- <li><a class=\"btn_show\" href=\"#1\">> 更高生物利用度(更好更快被吸收)、高活性成分、不刺激肠胃。</a></li> --> </ul> </div> <div class=\"pages\"> <ul> <li><a href=\"javascript:;\"> < </a></li> <li><a href=\"#\"> 6 </a></li> <li><a href=\"javascript:;\"> > </a></li> <li><a href=\"javascript:;\" tpldata=\"newslist_nextpage::updateattribute::href\" href=\"{$newslist_nextpage}\"> 下一页 </a></li> </ul> </div> </div>",
"pagefooter":"<div id=\"footer\"> <script> if(1==1){console.log(\"2nd 1==1.\"+(new Date()));} else if(2==2) {if(3==3){console.log(\"2nd 3==3\"+(new Date()));};}; function aFunc(myi){if (1==1){console.log(\"this is in aFunc \"+(new Date())+''+myi); return ('now:'+(new Date())+''+myi);}} </script> <div class=\"f_box\"> <div class=\"f_logo\"> <a href=\"http://ufqi.com/\"> base code </a> </div> <div class=\"f_logo\"> <a href=\"javascript:;\"> wenxin logo</a> </div> <div class=\"allright\"> footer bottom </div> <div class=\"f_menu\"> <ul> <li><a href=\"contact.html\">联系我们</a></li> <li><a href=\"legal.html\">法律声明</a></li> <li class=\"last\"><a href=\"http://www.miit.gov.cn/\" target=\"_blank\" >京ICP备1204600号 </a> © <span tpldata=\"copyright_year::updatevalue::\">{$copyright_year}</span> UFQI. 保留所有权利.</li> </ul> </div> <div class=\"allright_2\" onclick=\"javascript:if(1==1){aFunc();}else{if(1==1){aFunc();}}\">footer logo</div> </div> </div>"
}
</div>
<!--
@todo include with scripts
---- done, Dec 04, 2018
-->
<script>
if(1==1){
console.log("additional original scripts after jsondata will be invoked only once....."
+ (new Date()));
}
//-
function bFunc(myi){
console.log("this is in bFunc "+(new Date())+''+myi); return ('now:'+(new Date())+''+myi);
}
</script>
<!-- jstpl codes -->
<script>
window.JSTpl = {'JsonDataId':'jstpljsondata', 'IsDebug': true}; // optional
</script>
<script type="text/javascript" src="jstpl.js"></script>
</body>
</html>