...
Advanced Tables - Table Plus |
---|
heading | 0 |
---|
multiple | false |
---|
enableHeadingAttributes | false |
---|
enableSorting | false |
---|
class | m5-configuration-tree |
---|
enableHighlighting | false |
---|
|
|
...
Advanced Tables - Table Plus |
---|
heading | 0 |
---|
multiple | false |
---|
enableHeadingAttributes | false |
---|
enableSorting | false |
---|
class | m5-configuration-tree |
---|
enableHighlighting | false |
---|
|
节点名 | 值 |
---|
pages pages | | demo-features | | stkHome | | stkSection | | stkArticle | |
|
这些模板可供编辑者在页面应用里选择使用。它们可以出现在页面应用的模板下拉菜单里,只需要:
在通用属性里,visible
属性设置为true
。- 模板在企业版的缺省网站定义或其他网站定义里设置为可用。
- 编辑者的权限已经可以获取特定的模板了。如要通过角色来限制权限,可在原型里的
/availability/<template name>/roles
节点下配置。
...
Section |
---|
Column |
---|
| 模板原型 Advanced Tables - Table Plus |
---|
heading | 0 |
---|
multiple | false |
---|
enableHeadingAttributes | false |
---|
enableSorting | false |
---|
class | m5-configuration-tree |
---|
enableHighlighting | false |
---|
| 节点名 | 值 |
---|
default | | templates | | prototype | | areas | | main | | areas | | intro | | areas | | infoBlock | |
|
|
Column |
---|
| 模板定义 Advanced Tables - Table Plus |
---|
heading | 0 |
---|
multiple | false |
---|
enableHeadingAttributes | false |
---|
enableSorting | false |
---|
class | m5-configuration-tree |
---|
enableHighlighting | false |
---|
| 节点名 | 值 |
---|
pages | | stkEvent | | areas | | main | | areas | | intro | | areas | | infoBlock | |
|
|
|
为了使模板具有唯一性,您可以在模板定义里:
...
- 页面级,如引用一个新的
templateScript
。以下讨论的stkRedirect
模板就是这样的一个例子。 - 导航级,通过修改缺省导航或编写一个全新的配置。这通常不是必须的,但可能适用于特别定制的模板。
- 区域级,通过引用不同的脚本并改变区域行为。参考
main
区域样例。 - 变异形式级,在特定模板里禁止区域,这样区域只会在指定的变异形式绘制,而不会在其他变异形式绘制。参考移动性了解这个选项是如何用在
stkHome
模板的stage
区域里的。 - JavaScript和CSS级,引用不同的CSS表或JavaScript。很少需要这种做法,无论原型还是具体模板定义都没有使用,不过CSS和JavaScript里有一个配置样例。
...
参考资料部分的页面>属性里有一个完整的列表,包含了可用的模板属性及用法。
通用属性
模板原型里分配的唯一一个所有具体模板都可用的属性是templateScript
,用来引用管理页面脚本,即main.ftl。
...
有两个例外:
stkGlossary
模板使用它自己的modelClass
,即GlossaryTemplateModel
,这个模型类通过扩展STKPageModel<STKPage>
来完成按字母排序的词汇表。
Advanced Tables - Table Plus |
---|
heading | 0 |
---|
multiple | false |
---|
enableHeadingAttributes | false |
---|
enableSorting | false |
---|
class | m5-configuration-tree |
---|
enableHighlighting | false |
---|
|
节点名 | 值 |
---|
pages pages | | stkGlossary | | areas | | bodyID | glossary | category | feature | class | info.magnolia.module.templatingkit.templates.pages.STKPage | dialog | standard-templating-kit:pages/glossary/stkGlossaryProperties | i18nBasename | info.magnolia.module.templatingkit.messages | modelClass | info.magnolia.module.templatingkit.templates.GlossaryTemplateModel | renderType | stk | subcategory | glossary | title | templates.stkGlossary.title | visible | true |
|
在页面编辑器里,页面显示到内部或外部重定向的路径,但在预览里,则显示目标页面。/demo-project/service/m5-campaign
页面使用的是stkRedirect
模板。
...
bodyID
:这是模板专有样式的CSS表所用的标签。参考Body类和ID以获得更多信息。bodyID
和subcategory
值常常会一致,但它们彼此之间没有依赖关系。category
和subcategory
:每个模板都会分配到一个类别里,同时大多数模板也会分配到子类。很多场合都使用了类别,参考类别和子类。dialog
:每个页面模板会连接到它自己的stk<Template name>Properties
对话框,这个对话框在STK > 对话框定义 /pages
里配置。页面顶部工具栏里的属性按钮可以打开此对话框,控制浏览器标题和导航标题及行为,页面元数据(关键字和描述),变异形式排除和页面依赖性。详细信息参看属性对话框。title
:在页面应用的模板下拉菜单里显示的模板标题。
Advanced Tables - Table Plus |
---|
heading | 0 |
---|
multiple | false |
---|
enableHeadingAttributes | false |
---|
enableSorting | false |
---|
class | m5-configuration-tree |
---|
enableHighlighting | false |
---|
|
节点名 | 值 |
---|
pages pages | | stkImageGallery | | areas | | bodyID | image-gallery | category | feature | class | info.magnolia.module.templatingkit.templates.pages.STKPage | dialog | standard-templating-kit:pages/imageGallery/stkImageGalleryProperties | i18nBasename | info.magnolia.module.templatingkit.messages | modelClass | info.magnolia.module.templatingkit.templates.pages.STKPageModel | renderType | stk | subcategory | imageGallery | title | templates.stkImageGallery.title | visible | true |
|
extends属性Magnolia CMS使用扩展机制来最小化配置。这个机制类似于单个模板定义和原型定义之间的关系,只不过它很直观。扩展配置中只配置修改、例外和添加物,其他所有配置都照搬基本配置。
...
Advanced Tables - Table Plus |
---|
heading | 0 |
---|
multiple | false |
---|
enableHeadingAttributes | false |
---|
enableSorting | false |
---|
class | m5-configuration-tree |
---|
enableHighlighting | false |
---|
|
节点名 | 值 |
---|
pages | stkArticlepages | | stkArticle | | stkLargeArticle | | stkNews | | areas | | dialog | standard-templating-kit:pages/news/stkNewsProperties | extends | /modules/standard-templating-kit/templates/pages/stkArticle | subcategory | news | title | templates.stkNews.title |
|
...
Advanced Tables - Table Plus |
---|
heading | 0 |
---|
multiple | false |
---|
enableHeadingAttributes | false |
---|
enableSorting | false |
---|
class | m5-configuration-tree |
---|
enableHighlighting | false |
---|
|
节点名 | 值 |
---|
pages pages | | demo-features | | stkSectionNoExtras | | areas | | extends | /modules/standard-templating-kit/templates/pages/stkSection | title | Section no Extras | stkSectionNoHeader | | stkSectionFloating | |
|
extends属性也可设置为
override
来覆写部分扩展配置。参考使组件可用中的样例。
...
区域定义可以引用对话框。除了stkHome
的所有具体模板的main/intro
区域都使用该选项,来引用模板专有的属性对话框。更多信息参考intro区域。
Advanced Tables - Table Plus |
---|
heading | 0 |
---|
multiple | false |
---|
enableHeadingAttributes | false |
---|
enableSorting | false |
---|
class | m5-configuration-tree |
---|
enableHighlighting | false |
---|
|
节点名 | 值 |
---|
stkSection | | areas | | main | | areas | | intro | | class | info.magnolia.module.templatingkit.templates.MainAreaIntro | dialog | standard-templating-kit:pages/section/stkSectionIntro | divID | page-intro | showAuthorDate | false | showTextFeatures | false |
|
使组件可用
...
Advanced Tables - Table Plus |
---|
heading | 0 |
---|
multiple | false |
---|
enableHeadingAttributes | false |
---|
enableSorting | false |
---|
class | m5-configuration-tree |
---|
enableHighlighting | false |
---|
|
节点名 | 值 |
---|
stkArticle | | areas | | promos | | availableComponents | | stkTextImage | | id | standard-templating-kit:components/content/stkTextImage | stkQuotedText | | id | standard-templating-kit:components/content/stkQoutedText |
|
...
...
...
您可以这样来测试:以样例编辑者Eric(username/password=eric
)的身份登录,尝试在任意文章页面的content
区域添加stkHTML
组件。结果将会是,stkHTML
组件在选择器对话框里不可用。
...
特性模板覆写了默认类型,将其改为single
。特性组件在/areas/main/areas/content/autoGeneration/content/singleton
节点里添加。参考特色组件和自动生成的组件。
Advanced Tables - Table Plus |
---|
heading | 0 |
---|
multiple | false |
---|
enableHeadingAttributes | false |
---|
enableSorting | false |
---|
class | m5-configuration-tree |
---|
enableHighlighting | false |
---|
|
节点名 | 值 |
---|
stkImageGallery | | areas | | main | | areas | | content | | autoGeneration | | content | | singleton | | maxImages | 9 | nodeType | mgnl:component | templateId | standard-templating-kit:components/features/stkImageGallery | generatorClass | info.magnolia.rendering.generator.CopyGenerator | type | single |
|
使能区域
大多数区域在原型里是使能的,因此需要在特定的模板定义里禁用,改变默认设置。您可以将/areas/<area name>
内容节点下的enabled
属性节点值设置为false
来做到。另一方面,类似stage
或platform
的区域由于很少使用,所以在原型里是不使能的,这种情况就需要设置enabled
属性值为true
来改变。
...
- 对扩展模板与基本模板有着同样的作用。例如,如果您在
stkArticle
上禁用extras
,所有内容模板上都会禁用该区域;要在您的扩展模板上使能该区域,需要在扩展模板上添加enabled
属性并设置为true
。 - 可能影响页面布局。以下是一些样例,样例中的结果主要是由于页面排列和内容包装的方法造成的。
- 当
extras
被禁用时,main
区域会展开占用所有的可用空间。
- 当
promos
被禁用时,原本它占用的可用空间里什么都不会绘制。
- 当
base
、stage
或是sectionHeader
被禁用时,内容会上移显示,就像被禁用的区域不曾存在一样。区域在使能但不包含任何内容时,预览模式里也会发生同样的情况。下面的截图为禁用了stage
的stkHome
模板。
...
/areas/main
节点:- 使用它自己的类,
SectionMainArea
,来定义opener
区域属性。 - 由
/section/mainArea.ftl
脚本绘制。该脚本与默认使用的/global/mainArea.ftl
脚本唯一的不同在于,它使用[@cms.area name="opener"/]
标签添加了opener
区域。
/areas/main/areas/opener
节点:
...
默认情况下,您可以扩展stkHome
和stkSection
模板来配置一个浮显模板,这是因为它们都使用SectionMainArea
类和要点组件。其它的场景则需要定制。STK > 模板定义 /pages/demo-features/stkSectionFloating
里的stkSectionFloating
模板就是扩展stkSection
模板的一个例子,它:
这是基于stkSectionFloating
模板的demo-features/section-variables/floating
页在公共实例上的样子。该页解析到body
元素里包含的一个属性(attribute),即allowedBodyClass=nav-col-float2
里。main
区域的每个要点都包装在一个DIV元素内。
...
变异形式可以用于多种用途,例如重新排版智能手机和平板设备的内容,或已登录用户组的特定输出等。移动性里有关于演示站点里智能手机变异形式smartphone
变异形式样例的详细讨论,通道里也有此核心功能的更多信息。
变异形式通常在网站定义里配置,但也可以在模板定义里的模板级别上配置。舞台是使用该选项在智能手机上禁用stage
区域的例子。
...
Advanced Tables - Table Plus |
---|
heading | 0 |
---|
multiple | false |
---|
enableHeadingAttributes | false |
---|
enableSorting | false |
---|
class | m5-configuration-tree |
---|
enableHighlighting | false |
---|
|
节点名 | 值 |
---|
pages | | stkSection | | areas | | variations | | newsletter | | areas | | sectionHeader | | enabled | false | extras | | enabled | false | promos | | enabled | false | base | | enabled | false |
|
如果您在任意基于stkSection
模板的页面上,只需将扩展名从.html
改为.newsletter
,变异形式的内容就出现了。
...
变异形式通过DefaultRenderableVariationResolver
解析,这个解析器是(ChannelVariationResolver
和ExtensionVariationResolver
的结合。的结合)
解析。
Warning |
---|
此功能使用时需小心,因为它允许用户通过改变URL扩展名来获取内容。如果用于敏感内容,那么考虑扩展DefaultRenderableVariationResolver 来提供额外的安全措施。 |
...
Advanced Tables - Table Plus |
---|
heading | 0 |
---|
multiple | false |
---|
enableHeadingAttributes | false |
---|
enableSorting | false |
---|
class | m5-configuration-tree |
---|
enableHighlighting | false |
---|
|
节点名 | 值 |
---|
pages | | stkArticle | | cssFiles | | articleStyles | | farFutureCaching | true | link | /resources/templating-kit/css/articleStyles.css | media | screen | jsFiles | | fireworks | | farFutureCaching | true | link | /resources/templating-kit/js/fireworks.js |
|
组件定义
组件是页面上最小的内容块。STK包括用于所有使用案例的组件,和从简单的文本组件到复杂的聚合要点等可用组件。单个组件在组件是页面上最小的内容块。STK包括用于所有使用案例的组件,可用组件(从简单的文本组件到复杂的聚合要点组件),以及更多。单个组件在组件页上讨论。
组件定义在STK > 模板定义 /components
里配置。定义以文件夹的形式排列,文件夹名表示组件类型。里配置,以文件夹的形式排列,文件夹名表示组件类型。
Advanced Tables - Table Plus |
---|
heading | 0 |
---|
multiple | false |
---|
enableHeadingAttributes | false |
---|
enableSorting | false |
---|
class | m5-configuration-tree |
---|
enableHighlighting | false |
---|
|
节点名 | 值 |
---|
components | | content | | teasers | | extras | | promos | | stkPromo | | features | | links | | stages | | footer | | pur | |
|
组件定义与页面定义相似,都使用同样的模板定义对象。页面和组件使用相同路径语法引用它们的对话框。此外,页面和组件使用相同的绘制工具绘制。组件定义与页面定义相似,使用相同的模板定义对象。页面和组件使用相同路径语法引用它们的对话框。此外,页面和组件还使用相同的绘制工具绘制。
在很多时候,都不需要从头开始创建一个新组件,您可以拷贝或扩展现有的,并按您的需要调整。多数情况下,您不需要从头开始创建一个新组件;您可以拷贝或扩展现有的,并按您的需要调整。
通常创建新组件包括以下几步:
- 创建一个对话框。
- 创建一个组件定义。
- 创建一个组件脚本。
- 使组件对组件脚本可用。
组件可用于编辑者通过编辑者可以在STK > 对话框定义里配置的相关组件对话框输入内容。对话框定义通过对话框属性映射到组件定义里。输入内容,来使用组件。对话框定义通过dialog
属性映射到组件定义里。
大多数组件在大多数组件在区域定义里分配给页面模板,区域定义可以是模板原型或具体页面模板定义的区域定义里被分配给页面模板。定义的。
组件模板属性
所有的STK组件定义都有以下属性:
description
:指向组件描述的消息包关键字。dialog
:到对话框定义的路径,有着:到对话框定义的路径,结构为<module name>:<path to definition>
结构。大多数STK对话框都在。大多数STK对话框都在STK > 对话框定义下配置。118nBasename
:国际化关键字,:国际化关键字,即info.magnolia.module.templatingkit.messages
,指向包含STK翻译的消息包。renderType
:值为stk时
分配的STKRenderer
是一个STK专用的绘制器,为所有的STK模板(页面和组件)所使用。templateScript
:指向绘制组件的脚本的路径。组件脚本在STK > 模板 /templating-kit/components
下。title
:在组件工具栏里绘制的组件标题。deletable
决定组件是否能被删除。如果设置为false
,那么删除组件动作在动作栏里不可用。在动作栏里不可用。 4.5.9+moveable
决定组件是否能被移动。如果设置为false
,那么移动图标在组件工具栏里不绘制,并且移动组件动作在动作栏里不可用。 4.5.9+writable
决定组件是否能被编辑。如果设置为false
,那么编辑图标在组件工具栏里不绘制,并且编辑组件动作在动作栏里不可用。 4.5.9+
参考资料 > 组件里有可用的组件模板属性以及它们的用法的完整列表。里有可用的组件模板属性的完整列表及用法。
Advanced Tables - Table Plus |
---|
heading | 0 |
---|
multiple | false |
---|
enableHeadingAttributes | false |
---|
enableSorting | false |
---|
class | m5-configuration-tree |
---|
enableHighlighting | false |
---|
|
节点名 | 值 |
---|
components | | content | | stkQuotedText | | deletable | false | description | paragraphs.content.stkQuotedText.description | dialog | standard-templating-kit:components/content/stkQuotedText | i18nBasename | info.magnolia.module.templatingkit.messages | moveable | false | renderType | stk | templateScript | /templating-kit/components/content/quotedText.ftl | title | paragraphs.content.stkQuotedText.title | writable | true |
|
以上的配置样例中,以上配置样例中,deletable
,、moveable
和writable
属性的使用使得组件可编辑,同时禁止移动和删除。以下为编辑者在页面编辑器里看到的。属性的配置使组件可编辑,但不可移动或删除。以下为编辑者在页面编辑器里看到的。
Tip |
---|
你也可以在原型或具体模板定义的区域定义里限制组件动作,利用分配给用户的角色你也可以利用分配给用户的角色,在原型的或具体模板的区域定义里限制组件动作。 |
模型类
很多组件使用它们自己的模型类,为组件提供业务逻辑,并且在一些实例中使定制属性对脚本可用。例如,以下的很多组件使用它们自己的模型类(model class),提供组件的业务逻辑,并且有时使脚本可以使用定制的属性。例如,以下的stkTeaser
组件使用了InternalTeaserModel
,允许链接到要点组件的内部内容。,允许要点组件链接到内部内容。
Advanced Tables - Table Plus |
---|
heading | 0 |
---|
multiple | false |
---|
enableHeadingAttributes | false |
---|
enableSorting | false |
---|
class | m5-configuration-tree |
---|
enableHighlighting | false |
---|
|
节点名 | 值 |
---|
components | | teasers | | stkTeaser | | parameters | | areas | | description | paragraphs.teasers.stkTeaser.description | dialog | standard-templating-kit:components/teasers/stkTeaser | i18nBasename | info.magnolia.module.templatingkit.messages | modelClass | info.magnolia.module.templatingkit.templates.components.InternalTeaserModel | renderType | stk | templateScript | /templating-kit/components/teasers/internalPage.ftl | title | paragraphs.teasers.stkTeaser.title |
|
internalPage.ftl
脚本绘制模型使能的目标内容的属性。以下为这个脚本的片段,该脚本在脚本绘制模型里配置的目标内容的属性。该脚本在STK > 模板 /templating-kit/components/teasers/interalPage.ftlftl,以下为这个脚本的片段
。
Code Block |
---|
[#-- Assigns: Get and check Teaser Target --]
[#assign target = model.target!]
[#assign hasTarget = target?has_content]
[#-- Assigns: Macro assigning Values --]
[#macro assignValues]
[#-- Assigns: Get Content --]
[#assign title = content.teaserTitle!target.title!target.@name]
[#assign kicker = target.kicker!]
[#assign text = content.teaserAbstract!target.abstract!]
[#assign teaserLink = model.teaserLink!] |
参数
组件定义的模板脚本可直接使用组件定义的/<component name>/parameters
节点里的属性对模板脚本可用,无需支持的模型类。这是一个嵌入功能。此节点也同样被模板类参数使用。节点里的属性,而无需支持的模型类。此节点也同样用作模板类参数。这是一个嵌入的功能。
参数属性被大量用于CSS样式。例如,在下面的stkTeaserNewsList
组件定义配置里:
- 为了达到使用CSS样式的目的,模板里设置了
divClass
,divIDPrefix
和headingLevel
属性可用于模板CSS样式目的,并且不依赖于模型类。更多信息可参考属性。这些属性不依赖于模型类。更多信息可参考Teaser IDs。 - 模板通过
NewsListModel modelClass
设置了searchForSubcategory
属性。这个组件会生成一个要点列表,其中要点的目标页面基于searchForSubcategory
属性由NewsListModel
模型类定义对模板可用。组件生成要点列表,要点为基于subcategory=news
页面模板的目标页面。的页面模板。 teaserLinkType
属性也由属性也通过modelClass
使能,并且将要点链接识别为内部链接。被模板所用,它标记要点链接为internal
链接。
Advanced Tables - Table Plus |
---|
heading | 0 |
---|
multiple | false |
---|
enableHeadingAttributes | false |
---|
enableSorting | false |
---|
class | m5-configuration-tree |
---|
enableHighlighting | false |
---|
|
节点名 | 值 |
---|
components | | teasers | | stkTeaserNewsList | | parameters | | divClass | teaser latest | divIDPrefix | teaser | headingLevel | h2 | searchForSubcategory | news | teaserLinkType | internal | description | paragraphs.teasers.stkTeaserNewsList.description | dialog | standard-templating-kit:components/teasers/stkTeaserNewsList | i18nBasename | info.magnolia.module.templatingkit.messages | modelClass | info.magnolia.module.templatingkit.templates.components.NewsListModel | renderType | stk | templateScript | /templating-kit/components/teasers/newsList.ftl | title | paragraphs.teasers.stkTeaserNewsList.title |
|
以下为newsList.ftl
脚本如何绘制脚本绘制divClass
,、
divIDPrefix
和headingLevel
属性的。您可以在属性的代码。您可以在STK > 模板 /templating-kit/components/teasers/newsList.ftl
获得此脚本。找到此脚本。
Code Block |
---|
[#-------------- RENDERING PART --------------]
[#-- Rendering: Latest News --]
<div class="${divClass}" ${divID} >
<${headingLevel}>${content.teaserTitle}</${headingLevel}> |
以下为由以下为stkNewsList
组件绘制而成的HTML。 组件绘制的HTML。
嵌套组件
很多STK组件都有嵌套组件。在页面上,主组件被首先创建,然后编辑者会创建子组件。很多STK组件都有嵌套组件。在页面上,主组件首先被创建,然后编辑者会创建子组件。stkPureLinkList
主组件只允许一个组件标题,链接是由主组件只允许有一个组件标题,它的链接是由stkInternalLink
,、stkExternalLink
或stkDownloadLink
组件创建的。
在主组件定义中:
Advanced Tables - Table Plus |
---|
heading | 0 |
---|
multiple | false |
---|
enableHeadingAttributes | false |
---|
enableSorting | false |
---|
class | m5-configuration-tree |
---|
enableHighlighting | false |
---|
|
节点名值 | 值 |
---|
components | | teasers | | stkPureLinkList | | parameters | | areas | | linkList | | availableComponents | | stkInternalLink | | id | standard-templating-kit:components/links/stkInternalLink | stkExternalLink | | stkDownloadLink | | description | areas.components.linkList.description | enabled | true | templateScript | /templating-kit/components/links/linkListArea.ftl | title | areas.components.linkList.title | type | list | description | paragraphs.teasers.stkTeaserPureLinkList.description | dialog | standard-templating-kit:components/teasers/stkTeaserPureLinkList | i18nBasename | info.magnolia.module.templatingkit.messages | renderType | stk | templateScript | /templating-kit/components/teasers/pureLinkList.ftl | title | paragraphs.teasers.stkTeaserPureLinkList.title |
|
pureLinkList.ftl
脚本使用页面模板里绘制区域的相同代码来绘制主组件。脚本全文在脚本绘制主组件与页面模板里绘制区域的代码相同。脚本全文在STK > 模板 /templating-kit/components/teasers/pureLinkList.ftl
下。这里为相关片段。下,这里为相关片段。
Code Block |
---|
[#-- Rendering the teaser's linkList --]
[@cms.area name="linkList"/] |
linkListArea.ftl
脚本使用[#list]
指令来绘制嵌套组件。脚本全文在STK > 模板 /templating-kit/components/links/linkListArea.ftl
里。这里为相关片段。里,这里为相关片段。
Code Block |
---|
…
[#list components as component ]
[@cms.component content=component /]
[/#list]
… |
extends
属性
extends属性扩展机制被广泛使用来最小化extras
组件的配置。extras
组件有对应的teaser
组件,这两个区域绘制的组件基本相同,只有CSS样式和继承行为不一样。扩展机制被广泛使用,以最小化有着相应teaser
组件的extras
组件的配置。在这两个区域绘制的组件基本相同,只有CSS样式和继承行为不一样。
这里是stkTeaserContact
组件定义的完全配置。组件定义的配置全文。
Advanced Tables - Table Plus |
---|
heading | 0 |
---|
multiple | false |
---|
enableHeadingAttributes | false |
---|
enableSorting | false |
---|
class | m5-configuration-tree |
---|
enableHighlighting | false |
---|
|
节点名 | 值 |
---|
components | | teasers | | stkTeaserContact | | parameters | | divClass | box vcard | divIDPrefix | teaser | headingLevel | h2 | teaserLinkType | internal | description | paragraphs.teasers.stkTeaserContact.description | dialog | standard-templating-kit:components/teasers/stkTeaserContact | i18nBasename | info.magnolia.module.templatingkit.messages | modelClass | info.magnolia.module.templatingkit.templates.components.ContactModel | renderType | stk | templateScript | /templating-kit/components/teasers/contact.ftl | title | paragraphs.teasers.stkTeaserContact.title |
|
stkExtrasContact
组件扩展要点组件,只修改组件扩展了要点组件,只修改了divIDPrefix
和dialog
引用部分。stkExtrasContact
对话框也是stkTeaserContact
对话框的一个扩展,添加了在子页面中显示域,允许子页面继承。您可以在字段,允许子页面继承。您可以在STK > 对话框定义 /components/teasers/stkTeaserContact
和/extras/stkExtrasContact
里查看引用的对话框。更多信息可参考可继承组件。
Advanced Tables - Table Plus |
---|
heading | 0 |
---|
multiple | false |
---|
enableHeadingAttributes | false |
---|
enableSorting | false |
---|
class | m5-configuration-tree |
---|
enableHighlighting | false |
---|
|
节点名 | 值 |
---|
components | | extras | | stkExtrasContact | | parameters | | divIDPrefix | box | dialog | standard-templating-kit:components/extras/stkExtrasContact | extends | /modules/standard-templating-kit/templates/components/teasers/stkTeaserContact |
|
自动生成的组件
自动生成特性允许您在页面的任何区域内自动生成组件。这是Magnolia 自动生成特性使您在页面的任何区域都可以自动生成组件。这是Magnolia CMS核心功能,由以下类提供:
ConfiguredAutoGeneration
类(由AreaElement
引入),提供在区域定义中的引入),在区域定义中提供autoGeneration
节点和属性。CopyGenerator
生成器类,创建节点和属性,这些属性与链接到生成器类(generator class),创建节点和属性,使他们与templateId
属性并且只适用于属性里链接到的且只适用于autoGeneration
节点的配置一致。
自动生成的组件可在任何区域定义里配置。以下配置样例在stkEvent
模板的嵌套extras1
区域自动生成stkExtrasCalendar
组件。参考extras区域获得关于extras
区域里可用配置选项的更多信息。组件。关于extras
区域里可用的配置选项,请参考extras
区域。
/areas/<area name>/autoGeneration
父节点和/content
子节点需要有这些特定的名字。这种命名规则和节点结构将配置识别为自动生成内容。子节点需要有这些特定的名字。这种命名规则和节点结构可以识别配置为自动生成内容。/autoGeneration/generatorClass
节点分配CopyGenerator
类,允许任何该组件可用的属性使用被类,允许使用templateId
属性引用。属性引用的组件可用的任何属性。/autoGeneration/content/calendar
节点可以被任意命名。这个例子中的属性只是必需的属性,但可以依据引用的组件(参考以下样例)添加额外的属性。nodeType
被设置为mgnl:component
,以将引用的组件识别为一个组件。,将引用的组件识别为一个组件。
templateId
定义到组件定义的路径,使用<module name>:<path to definition>
格式。
Advanced Tables - Table Plus |
---|
heading | 0 |
---|
multiple | false |
---|
enableHeadingAttributes | false |
---|
enableSorting | false |
---|
class | m5-configuration-tree |
---|
enableHighlighting | false |
---|
|
节点名 | 值 |
---|
pages | | stkEvent | | areas | | extras | | areas | | extras1 | | autoGeneration | | content | | calendar | | nodeType | mgnl:component | templateId | standard-templating-kit:components/extras/stkExtrasCalendar | generatorClass | info.magnolia.rendering.generator.CopyGenerator |
|
...
下面的例子在stkArticle
模板的main/content
区域自动生成stkHTML
组件。因为其他内容模板扩展该模板,该组件也在组件。因为有其他内容模板扩展了该模板,该组件也在stkLargeArticle
,、stkNews
,、stkEvent
和stkGlossaryTerm
模板上绘制。
这是绘制stkHTML
组件的html.ftl
脚本。注意一个单属性,脚本。注意,editHTML
,在此组件中绘制。属性在此组件中绘制。
Code Block |
---|
[#if content.editHTML?has_content]
${cmsfn.decode(content).editHTML}
[/#if] |
这是样例的配置,用来在以下配置样例用来在stkArticle
模板的main/content
区域绘制此组件:
- 基本配置与上一个例子一样。基本配置与上例一样。
editHTML
属性的添加会在脚本里添加由[cmsfn.decode]
方法绘制的HTML代码。
Advanced Tables - Table Plus |
---|
heading | 0 |
---|
multiple | false |
---|
enableHeadingAttributes | false |
---|
enableSorting | false |
---|
class | m5-configuration-tree |
---|
enableHighlighting | false |
---|
|
节点名 | 值 |
---|
pages | | stkArticle | | areas | | main | | areas | | content | | availableComponents | | autoGeneration | | content | | conference | | editHTML | <p><font color="#669900" size="+1">Sign up for the</font><font size="+1">....../strong></a>.</font> </p> | nodeType | mgnl:component | templateId | standard-templating-kit:components/content/stkHTML | generatorClass | info.magnolia.rendering.generator.CopyGenerator |
|
这里是基于stkArticle
模板的新页面上的自动生成组件。模板的一个新页面上的自动生成组件。
...
特性组件
特色模板主要由在页面模板的特性模板主要通过页面模板的main/content
区域绘制的组件区分开。区域绘制的组件标识。stkImagGallery
,stkFAQ
,stkSiteMap
等组件在stkImageGallery
, stkFAQ
, stkSiteMap
等模板的该区域绘制。组件由页面模板自动绘制,由自动生成特性完成。
组件定义与其他组件使用的配置方法,您可以在特性组件定义与其他组件配置方法相同,您可以在STK > 模板定义 /components/features
里查看。
下列所示的stkSiteMap
组件:
- 使用使用了
SiteMapParagraphModel
,包含了业务逻辑,并使,这个模型类包含业务逻辑,并使maxLevels
,、showSiteMapRoot
,和titleToUse
属性对脚本可用。 - 由
siteMap.ftl
脚本绘制,该脚本可在脚本绘制。该脚本在STK > 模板 /templating-kit/components/features/siteMap.ftl
找到。。
Advanced Tables - Table Plus |
---|
heading | 0 |
---|
multiple | false |
---|
enableHeadingAttributes | false |
---|
enableSorting | false |
---|
class | m5-configuration-tree |
---|
enableHighlighting | false |
---|
|
节点名 | 值 |
---|
components | | features | | stkSiteMap | | description | paragraphs.features.stkSiteMap.description | dialog | standard-templating-kit:components/features/stkSiteMap | i18nBasename | info.magnolia.module.templatingkit.messages | modelClass | info.magnolia.module.templatingkit.templates.components.SiteMapParagraphModel | renderType | stk | templateScript | /templating-kit/components/features/siteMap.ftl | title | paragraphs.features.stkSiteMap.title |
|
当一个基于stkSiteMap
模板的页面被创建时,组件被使用区域定义(见下表)中配置的缺省值绘制。编辑者可以在模板的页面被创建时,组件使用区域定义中配置的缺省值(见下表)绘制。编辑者可以在STK > 对话框定义 /components/features/stkSiteMap
下配置的stkSiteMap
组件对话框里修改这些缺省值。查看组件对话框里修改这些缺省值。您也可以查看demo-project/service/site-map
页了解它是如何工作的。
在stkSiteMap
页面模板的页面模板里,areas/main/areas/content
节点下:节点的:
/autoGeneration
节点在generatorClass
节点的CopyGenerator
类里分配。该生成器创建节点和属性,其中属性和链接到类里分配。该生成器创建节点和属性,使他们与templateId
属性并且只适用于属性里链接到的且只适用于autoGeneration
节点的配置一致。- 在
autoGeneration/content/singleton
节点里: - 缺省值被分配给显示给组件模型的属性。组件模型显示的属性使用缺省值。
nodeType
被设置为设置为mgnl:component
。templatedId
属性引用stkSiteMap
组件定义,使用<module name>:<path to component>
结构。
Advanced Tables - Table Plus |
---|
heading | 0 |
---|
multiple | false |
---|
enableHeadingAttributes | false |
---|
enableSorting | false |
---|
class | m5-configuration-tree |
---|
enableHighlighting | false |
---|
|
节点名 | 值 |
---|
pages | | stkSiteMap | | areas | | main | | areas | | intro | | content | | autoGeneration | | content | | singleton | | maxLevels | 3 | nodeType | mgnl:component | showSiteMapRoot | true | templateId | standard-templating-kit:components/features/stkSiteMap | titleToUse | title | generatorClass | info.magnolia.rendering.generator.CopyGenerator | type | single | class | info.magnolia.module.templatingkit.templates.MainArea |
|
这里是这是stkSiteMap
组件和demo-project/service/site-map
页面上的对话框。
...
在上面的对话框里,maxLevels
属性被设置为4
。这是因为模板定义里的缺省值,这是因为模板定义里的缺省值3
在此页上已经被覆写了。新值4
被存在JCR中,您可以在工具 > JCR /demo-project/service/site-map/content/singleton
中验证。
Advanced Tables - Table Plus |
---|
heading | 0 |
---|
multiple | false |
---|
enableHeadingAttributes | false |
---|
enableSorting | false |
---|
class | m5-configuration-tree |
---|
enableHighlighting | false |
---|
|
节点名 | 值 |
---|
demo-project | | service | | site-map | | content | | singleton | | maxLevels | 4 | showSiteMapRoot | true | titleToUse | title |
|
如果您想要在模板定义中修改一个自动生成的组件的缺省设置,您需要首先在JCR浏览器中删除这个内容节点(如果您想要在模板定义中修改一个自动生成组件的默认设置,您需要首先在JCR浏览器中删除这个内容节点(singleton
)并刷新该页。系统会使用新的模板定义属性在页面上重新创建该组件。这是一个已知问题,您可以在MAGNOLIA-4482里跟踪进展。