主题 : 栏目高亮报错 |
级别: 商业授权用户
![]() |
22# 发表于:2017-07-26 15:41:06 IP:222.2.*.*
我都进行过判断了还是报没有parent的错误
我的导航有的没有子导航 如果有父级导航就用parent,如果没有就直接写id,很简单的逻辑为啥老是报错呢 FreeMarker template error (DEBUG mode; use RETHROW in production!): The following has evaluated to null or missing: ==> channel.parent [in template "WEB-INF/t/cms/www/default/channel/news.html" at line 18, column 20] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like 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 parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #if channel.parent.id?? [in template "WEB-INF/t/cms/www/default/channel/news.html" at line 18, column 15] ---- Java stack trace (for programmers): ---- freemarker.core.InvalidReferenceException: [... Exception message was already printed; see it above ...] at freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:134) at freemarker.core.UnexpectedTypeException.newDesciptionBuilder(UnexpectedTypeException.java:80) at freemarker.core.UnexpectedTypeException. |
||
---|---|---|---|
级别: 商业授权用户
![]() |
24# 发表于:2017-07-26 15:42:47 IP:222.2.*.*
[@cms_channel_list parentId=channel.id]
[#list tag_list as c] [#if c.parent.id??] ${channel.parent.name!} [#else] ${channel.name!} [/#if] [/#list] [/@cms_channel_list] 这样判断没有语法错误吧 |
||
---|---|---|---|
级别: 商业授权用户
![]() |
25# 发表于:2017-07-26 15:43:55 IP:222.2.*.*
这块真心搞不懂啊,我就想判断父级id是否存在,不存在我就写channel.id,存在就用parent.id,老是搞不对
|
||
---|---|---|---|
级别: 总版主
![]() |
26# 发表于:2017-07-26 15:44:36 IP:106.242.*.*
${channel.parent.name!} 你这个页面单独取这个父栏目值取得到没有??确定下这个属性有值没有
|
||
---|---|---|---|
级别: 版主
![]() |
27# 发表于:2017-07-26 15:46:51 IP:106.242.*.*
你这判断没什么意义,如果当前栏目没子栏目什么都不会打印,有子栏目就只会打印你当前栏目的父栏目
|
||
---|---|---|---|
级别: 商业授权用户
![]() |
28# 发表于:2017-07-26 15:47:53 IP:222.2.*.*
回复第26楼
点击子导航就存在 点击一级导航就报错 所以我才判断父级导航id是否存,存在就用这个标签不存在就不用,可是发现判断了也不起作用,还是报错 |
||
---|---|---|---|