5

我正在开发一个 Sitecore (6.4.0.101124) 网站,该网站有两个用于主页的模板。它们具有非常相似的结构 - 它们之间的最大区别在于它们在标准值的表示详细信息的控件部分中都有一个不同的子布局。我的理解是,当在项目上更改模板时,应将模板的标准值应用于该项目。但是,当内容编辑器更改模板时,演示详细信息保持不变,直到我进入并更改它们。

所以这意味着要么我误解了它应该如何工作,要么正在发生一些奇怪的事情。这与此线程中讨论的问题非常相似,但给出的答案似乎并不适用,因为该项目不是使用分支模板创建的。

有没有人有过类似的经历(并解决了)?我在这应该如何工作方面偏离了基础吗?

4

3 回答 3

8

You write:

My understanding is that when the template is changed on an item the standard values of the template should be applied to that item.

This is only true if a field has not been edited. Once a field for an item has been edited, the edited value takes precedence over the default. Changing the template to one that has different Standard Values will only have an impact if the field has not been touched, or if the user resets the field to the default value using the Fields Reset button. (Note that manually clearing the field will not do the trick. Sitecore will store an empty string, which will override the Standard Value. By using the Reset button, you set the field to a Database Null, which causes the Standard Value to be used.)

Reset Button

You can tell if a field has been edited by checking for the text "standard value" next to the field in the Content Editor:

Standard Values display hint


Sitecore 6.4.0 and Layout Deltas

Things are more complex with the Renderings field on Sitecore 6.4.0 and above, because Sitecore introduced a feature called "Layout Deltas" with this release. Before Layout Deltas, if you edited the presentation details of an item, Sitecore would copy the layout information from the "Renderings" field of Standard Values into the item's Renderings field, which had the consequence that any subsequent change to Standard Values Renderings would have no effect on the display of this item.

This functionality made it difficult to manage changes to presentation, since a minor change to a detail of presentation on an individual item, such as adding conditional rendering logic, would break the inheritance from Standard Values. If if was necessary to change the presentation of a class of items, it was necessary to first change Standard Values, and then to make the same change to every item that modified presentation.

With Sitecore 6.4's Layout Deltas, if you modify the presentation of an item, just the change is stored in the item's Renderings field, rather than a complete copy of the Standard Values rendering. This change, or delta, information is applied on top of the Standard Values Renderings information, so that modifications to Standard Values layouts are applied to all inheriting items, not just ones with unmodified presentation.

It sounds like your content editors have made a modification to the presentation of the item. When the template is switched, this change is being applied on top of the new template. You can confirm this by checking for the [Standard Values] text next to the Renderings field of the item in question.

于 2012-10-04T04:43:05.627 回答
3

模板具有值,但是将值携带到使用该模板创建的项目中的是标准值项目。现在,话虽如此,从该模板创建的项目上的每个字段都有一个标志,表明它是否使用模板标准值。如果演示详细信息仍未标记为使用标准值,则它不会级联对项目的更新。

现在.. 确保您了解分支和模板之间的区别.. 分支是您如何创建项目的“模型”。当您对分支项目进行更改时,它根本不会级联更改。项目将从其 TEMPLATE 标准值继承值。分支值仅在项目创建时继承。

编辑:顺便说一句,我应该补充一点,如果您打开左侧的装订线以显示已覆盖的演示文稿,您可以查看演示文稿值是否为标准值。如果您看到该图标,则您知道该项目当前未使用标准值。

于 2012-10-02T00:22:53.367 回答
1

我遇到了这个问题,因为我有一个需要更改数百页的字段。一开始就没有分享。我尝试在模板中将该字段设置为 Shared & Unversioned,但这并没有导致它在我进行更改时随处更改。

然后我继续在模板中将标准值设置为我想要的字段,然后在突出显示标准值后选择版本 -> 字段 -> 重置。我第一次这样做时,它将字段重置为空白。然后我又做了一次,使用该特定字段的每个页面上的字段都发生了变化。希望这可以帮助。似乎如果您已经有一个未共享的字段,则需要对其进行标准值重置。

于 2013-06-13T20:21:04.780 回答