@Component public class CmsCategoryDirective extends AbstractTemplateDirective
参数列表
id
:分类id,结果返回object
CmsCategory
code
:分类编码,当id为空时生效,结果返回object
absoluteURL
:url处理为绝对路径 默认为true
containsAttribute
默认为false
,http请求时为高级选项,为true时object.attribute
为分类扩展数据map
(字段编码,value
)
ids
:
多个分类id,逗号或空格间隔,当id或code为空时生效,结果返回map
(id,object
)
<@cms.category id=1>${object.name}</@cms.category>
<@cms.category ids=1,2,3><#list map as k,v>${k}:${v.name}<#sep>,</#list></@cms.category>
<script> $.getJSON('${site.dynamicPath}api/directive/cms/category?id=1', function(data){ console.log(data.name); }); </script>
限定符和类型 | 字段和说明 |
---|---|
private CmsCategoryAttributeService |
attributeService |
private CmsCategoryService |
service |
ADVANCED, AUTH_TOKEN, AUTH_USER_ID, siteComponent
log
构造器和说明 |
---|
CmsCategoryDirective() |
限定符和类型 | 方法和说明 |
---|---|
void |
execute(RenderHandler handler) |
boolean |
supportAdvanced() |
execute, expose, getAdvanced, getApp, getSite, getUserId, needAppToken, needUserToken
execute, getName, getNamespace, getShortName, httpEnabled, setName, setNamespace, setShortName
private CmsCategoryService service
private CmsCategoryAttributeService attributeService
public void execute(RenderHandler handler) throws java.io.IOException, freemarker.template.TemplateException
java.io.IOException
freemarker.template.TemplateException
public boolean supportAdvanced()
supportAdvanced
在类中 AbstractTemplateDirective