模板
360 {% if mtags %}
361 {% for tag in mtags %}
362 {#{tag.id}#}
363 <li class="nav-header"> {{tag.content}} </li>
364 <div class="xz">
365 {% for t in tag.children %}
366 <a href="#">{{t.id}}:{{t.content}}</a>
367
368 {% endfor %}
369 </div>
370 {% endfor %}
371 {% endif %}
正确方法
返回数据
36 Tags = boss_db:find(tag,[{parent_id,"0"}]),
37 F = fun(Tag) ->
38 TagChildren = boss_db:find(tag, [{parent_id, Tag:id()}]),
39 [{id,Tag:id()}, {content, Tag:content()}, {children, TagChildren}]
40 end,
41 [F(Tag)||Tag<-Tags].
错误数据格式:
[{struct,[{id,"id"},{content,"this is conet"}]},{struct,[{id,"id-2"},{content,"this seconde is conet"}]}].
这样定义页面会提示找不到struct 确实因为没有struct mode module
想到list 果然list 可以
[[{id,"id"},{content,"this is conet"},{tt,Tags}],[{id,"id-2"},{content,"this seconde is conet"},{"tt",Tags}]].