类 CmsContentDirective

所有已实现的接口:
Directive, HttpDirective, freemarker.template.TemplateDirectiveModel, freemarker.template.TemplateModel

@Component public class CmsContentDirective extends AbstractTemplateDirective

content 内容查询指令

content query directive

コンテンツクエリーディレクティブ

参数列表

parameter list

パラメータリスト

  • id 内容id,结果返回objectCmsContent
  • id content id, result returns object CmsContent
  • id コンテンツID、結果はobject CmsContent を返します
  • absoluteURL:url处理为绝对路径 默认为 true
  • absoluteURL:process url as absolute path, default is true
  • absoluteURL:URLを絶対パスに処理する、既定値は true
  • absoluteId:id处理为引用内容的ID 默认为 true
  • absoluteId:process id as referenced content id, default is true
  • absoluteId:IDを参照コンテンツのIDに処理する、既定値は true
  • containsAttribute 默认为false,http请求时为高级选项,为true时object.attribute为内容扩展数据map(字段编码,value)
  • containsAttribute default is false, advanced option for http requests, when true, object.attribute is content extended data map(field code, value)
  • containsAttribute 既定値は false, HTTPリクエスト時の高度なオプション、trueの場合 object.attribute はコンテンツ拡張データ map(フィールドコード, value)
  • ids: 多个内容id,逗号或空格间隔,当id为空时生效,结果返回map(id,object)
  • ids: multiple content ids, separated by commas or spaces, effective when id is empty, result returns map(id, object)
  • ids: 複数のコンテンツID、カンマまたはスペースで区切る、IDが空のときに有効、結果はmap(ID, object)を返します

使用示例

usage example

使用例

<@cms.content id=1>${object.title}</@cms.content>

<@cms.content ids=1,2,3><#list map as k,v>${k}:${v.title}<#sep>,</#list></@cms.content>

  <script>
   $.getJSON('${site.dynamicPath}api/directive/cms/content?id=1', function(data){    
     console.log(data.title);
   });
   </script>