Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
[#list components as component]
   [@cms.component content=component /]
[/#list]

cms:component

The cms:component directive (ComponentDirective) renders a component. The content attribute defines what content the component edits. This tag is commonly used inside the list directive to loop through the components in a map.

The content to render, and possibly edit in case of an editable component, is passed in the content attribute. On the author instance the directive renders a component toolbar. The value of the title property in the component definition is rendered on the bar.

Image Removed

指令(ComponentDirective)绘制组件content属性(attribute)定义组件编辑的内容。该标签符通常被用在list指令里来依次通过地图里的组件。

要绘制的内容,或对于可编辑组件可能的编辑,都是通过content属性(attribute)来传递。在编写实例上,指令绘制一个组件工具栏。组件定义里的title属性值在工具栏中绘制。

Image Added

属性(Attribute)描述缺省值
editable定义编辑图标是否应被显示,主要对继承的内容有用。
AttributeDescriptionDefault Value
editableDefines whether edit icons should be displayed. Mainly useful if content is inherited.cmsfn.isFromCurrentPage()
templateName of the component definition to useThe template defined in the node.要用到的组件定义名。节点里定义的模板。

示例:Example:

Code Block
[#list components as component ]
   [@cms.component content=component /]
[/#list]

...

常用指令属性

The 下列属性可用任何指令传递,它们定义指令创建的元件应该工作在什么内容上。The following attributes can be passed with any directive. They define which content the element created by the directive should work on.

Attribute属性(Attribute)Description描述Default value缺省值
contentA Node or ContentMap.一个节点或是内容地图。 
workspaceWorkspace used if path is defined.指定路径时用到的工作区。与当前内容相同Same as of the current content
pathPath in the workspace.工作区中的路径。 

...

content属性

The content attribute tells a script which content node it should operate on. Scripts typically operate on the "current" content node. For a page-level script the current node is the page, for an area-level script the current node is the area, and for a component-level script the current node is the component. However, there are cases where you want the script to operate on a different content node. This is where the content attribute comes handy.

content 属性(attribute)告诉脚本它应该在哪个内容节点上操作。脚本通常在“当前”内容节点上执行。对于一个页面级脚本,当前节点为该页面,而对于一个区域级脚本,当前节点就是该区域,同样,对于一个组件级脚本,当前节点就是该组件。然后,也有一些您想要脚本在一个不同的内容节点上执行的情况,这就是content属性变得方便实用的时候。

例如,For For example, the intro area has no content of its own. It doesn't contain any components either since it is of type noComponent. The area operates on page content instead. It edits and renders the page title and abstract. We achieve this by using the content attribute.

...