Page History
...
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.
指令(ComponentDirective)绘制组件。content
属性(attribute)定义组件编辑的内容。该标签符通常被用在list
指令里来依次通过地图里的组件。
要绘制的内容,或对于可编辑组件可能的编辑,都是通过content
属性(attribute)来传递。在编写实例上,指令绘制一个组件工具栏。组件定义里的title
属性值在工具栏中绘制。
属性(Attribute) | 描述 | 缺省值 | ||
---|---|---|---|---|
editable | 定义编辑图标是否应被显示,主要对继承的内容有用。 | |||
Attribute | Description | Default Value | ||
editable | Defines whether edit icons should be displayed. Mainly useful if content is inherited. | cmsfn.isFromCurrentPage() | ||
template | Name of the component definition to use | The 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缺省值 | |
---|---|---|---|
content | A Node or ContentMap.一个节点或是内容地图。 | ||
workspace | Workspace used if path is defined. | 指定路径时用到的工作区。 | 与当前内容相同Same as of the current content |
path | Path 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.
...