比較バージョン

キー

  • この行は追加されました。
  • この行は削除されました。
  • 書式設定が変更されました。
テンプレートインスタンスは、テンプレートファイル周りの構成をラップします。テンプレートファイルはテンプレートインスタンスのすべてのプロパティを受け取り、レンダリングロジックに通知するためにこれらのプロパティを使用することができます。これにより、テンプレートインスタンスに格納されている設定に基づいて、1つのテンプレートファイルが異なるレンダリングをするようになります。

テンプレートインスタンスが追加の設定を保存する必要がない単純なケースでは、テンプレートファイルへの非常に軽いポインタのままです。 さらに高度な場合、テンプレートインスタンスは、ページ上の要素のレイアウト方法に関するレンダリング時間情報を格納することがあります。

場所

  • classpath:/alfresco/site-data/template-instances
  • classpath:/alfresco/web-extension/site-data/template-instances

定義

コード ブロック
languagexml
themeEmacs
linenumberstrue
<template-instance>
  <template-type>TEMPLATE_TYPE_ID</template-type>
</template-instance>

プロパティ

  • <template-type> - このテンプレートインスタンスをレンダリングするために使用されるテンプレートタイプの ID。ここでテンプレートパスが提供されている場合、テンプレートタイプは FreeMarker とみなされ、パスはレンダリングに使用されます。

例 - landing template with configuration

コード ブロック
languagexml
themeEmacs
linenumberstrue
classpath:/alfresco/web-extension/site-data/template-instances/landing1.xml

<?xml version="1.0" encoding="utf-8" ?>
<template-instance>
  <id>landing1</id>
  <template-type>landing</template-type>
  <properties>
    <columns>2</columns>
    <rows>3</rows>
  </properties>
</template-instance>