Sitecore:如何向渲染添加一组“字段”(Sitecore: How to add a set of “fields” to a rendering)

编程入门 行业动态 更新时间:2024-10-28 12:20:32
Sitecore:如何向渲染添加一组“字段”(Sitecore: How to add a set of “fields” to a rendering)

在Sitecore中,我如何在渲染(.xslt)中添加几个字段?

更改渲染的“模板”,使其不再是正确的渲染。

目标是创建渲染,用户可以在页面编辑器中添加到占位符。

编辑:目前即时尝试使用子布局(.ascx) - 子布局是(..sublayout)的模板,“自定义”模板添加到“参数模板”字段。

In Sitecore, how would I go about adding a couple of fields to a rendering (.xslt)?

Changing the "template" of the render, makes it so it is no longer a proper rendering.

The goal is to create a rendering, the user can add to a placeholder in the page editor.

Edit: Currently im trying the same using sublayouts (.ascx) - The sublayout is of a template of (..sublayout), with a "custom" template added to the "Parameters Template" field.

最满意答案

看一下SDN上的Presentation Component XSL Reference 。

如果要更改模板,还需要更改渲染控件(XSLT或ASCX,具体取决于它是渲染还是子布局)以显示已添加到模板的新字段。

例如,如果向模板添加“单行文本”类型的“摘要”字段,则需要向XSLT添加以下内容:

<sc:text field="summary"/>

4.1节列出了不同的字段类型。

如果您正在使用ascx控件

<sc:FieldRenderer ID="scSummary" FieldName="Summary" runat="server" />

只是将字段添加到模板中不会导致它出现在网站上(当然,除非您将渲染/子布局编码为完全相同)。

Take a look at the Presentation Component XSL Reference on SDN.

If you are changing the template, you also need to change the rendering control (XSLT or ASCX depending on whether it is a Rendering or a Sublayout) to display the new field you have added to the template.

For example, if you add a field called "summary" of type "Single Line Text" to the template, then you need to add following to the XSLT

<sc:text field="summary"/>

Section 4.1 has a list of the different field types.

If you are using an ascx control then

<sc:FieldRenderer ID="scSummary" FieldName="Summary" runat="server" />

Just adding the field to the template will not cause it to appear on the site (unless, of course, you coded your rendering/sublayout to do exactly that).

更多推荐

添加,模板,rendering,template,电脑培训,计算机培训,IT培训"/> <meta name="desc

本文发布于:2023-07-22 03:54:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1216694.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:字段   add   Sitecore   rendering   fields

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!