主题 : tag_has_next标签使用报错
级别: 童生
UID: 69776
积分:35 加为好友
威望: 2 精华: 0
主题:3 回复:39
注册时间:2014-11-20
在线时长:0
1#   发表于:2015-10-11 23:11:18  IP:114.123.*.*
                    <ul class="submenu">
                        [#list tag_list as c1]
                        <li><a href="${c1.url}" target="_self">${c1.name}</a>[#if tag_has_next]|[/#if]</li>
                        [/#list]
                    </ul>

报错:FreeMarker template error: The following has evaluated to null or missing: ==> tag_has_next [in template "WEB-INF/t/cms/www/default/include/dyt_navi.html" at line 25, column 83] Tip: If the failing expression is known to be legally null/missing, either specify a default value with myOptionalVar!myDefault, or use [#if myOptionalVar??]when-present[#else]when-missing[/#if]. (These only cover the last step of the expression; to cover the whole expression, use parenthessis: (myOptionVar.foo)!myDefault, (myOptionVar.foo)?? The failing instruction (FTL stack trace): ---------- ==> #if tag_has_next [in template "WEB-INF/t/cms/www/default/include/dyt_navi.html" at line 25, column 78]

我想判断如果是最后一个元素  就不添加分隔符“ | ”  如果不是就添加。但是这么写一直报错。这个写法我是查的jeecms网上是这么写的:


[@cms_tag_list count='8'] 

[#list tag_list as tag] 

<a href="${base}/tag/${tag.id}.jspx" target="_blank">${tag.name}</a> 

[#if tag_has_next]|[/#if] 

[/#list] 

[/@cms_tag_list]<div> 
级别: 版主
UID: 70293
积分:78391 加为好友
威望: 1 精华: 0
主题:7 回复:68397
注册时间:2014-12-03
在线时长:0
2#   发表于:2015-10-12 08:36:31  IP:220.9.*.*
没这种写法,当然会报错
1
级别: 童生
UID: 69776
积分:35 加为好友
威望: 2 精华: 0
主题:3 回复:39
注册时间:2014-11-20
在线时长:0
3#   发表于:2015-10-12 23:59:47  IP:211.31.*.*
回复第2楼:那请问应该怎么用这个标签?
级别: 版主
UID: 70293
积分:78391 加为好友
威望: 1 精华: 0
主题:7 回复:68397
注册时间:2014-12-03
在线时长:0
4#   发表于:2015-10-13 08:28:14  IP:182.205.*.*
没有判断是否是最后一个的标签
1
级别: 童生
UID: 69776
积分:35 加为好友
威望: 2 精华: 0
主题:3 回复:39
注册时间:2014-11-20
在线时长:0
5#   发表于:2015-10-18 23:45:42  IP:114.166.*.*
回复第4楼:好的 明白  谢谢楼主
级别: 版主
UID: 70293
积分:78391 加为好友
威望: 1 精华: 0
主题:7 回复:68397
注册时间:2014-12-03
在线时长:0
6#   发表于:2015-10-19 09:54:59  IP:182.237.*.*
1
1 共1页