Sortorder of Inherited Templates

一曲冷凌霜 提交于 2019-12-23 09:58:22

问题


Using Sitecore 6.6 we are constructing some templates that inherit many base templates. This is great for reuse and standardizing our code, as all the fields are stored in a constants file for easy reference. However, we seem to be unable to define the order that these inherited templates are displayed.

The templates seem to be sticking to the original order they were added in no matter what. We've tried using the sortorder on the actual base templates themselves, but that doesnt appear to work. Likewise with just reordering the templates in the __Base template field picker.

Any ideas?


回答1:


That is a great approach for templating. To reorder the fields/fieldsets set the sortorder of the Template Fields and Template Sections themselves inside of the inherited templates.




回答2:


I have found that sorting template sections and fields often works best when using negative numbers. Strange but true.




回答3:


I have the same problem with sorting in template inheritance. I have been using a combination of negative and positive numbers, fixed this. Retro fitting does seem a pain and quite a lot of work though. Definitely something to think about upfront.




回答4:


My experience is that fields are added based on the Sort Order of the section, and if two sections have the same value, then the fields are added from the child template first.

Suppose you have a template My New Template that inherits from the Sample Item, with a field in the Data section called My New Field. Even if My New Field has a sort order of 300, and Title and Text are 100 and 200, My New Field will come first if both Data sections are set to 100. To make it come after Title and Text, set the section Sort Order to a higher value, like 150.



来源:https://stackoverflow.com/questions/16977777/sortorder-of-inherited-templates

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!