0
我知道如何以编程方式添加或创建项目。我的疑问是如何以编程方式分配模板?如何在sitecore中动态地将模板分配给其他模板?
Sitecore.Data.Database masterDatabase = Sitecore.Configuration.Factory.GetDatabase("master");
//This is master item.I want to add some items in this template.like below programatically
Item MasterItem = masterDatabase.GetItem("/sitecore/templates/DynamicTemplates/Employees");
//This is folder which has two templates[Developers,Tester].I want to assign these two as in image programatically.
Item GetAllTemplates = masterDatabase.GetItem("/sitecore/templates/DynamicTemplates/Team");
我认为这是坏主意编程继承模板。 什么情况下您需要这样的实施才能将开发人员和测试人员分配给MasterItem?为什么刚开始创建模板时,您只是从模板管理器分配? – 2014-01-11 10:14:46
我同意。虽然我提供了一个答案,但我会质疑为什么会这么做。 –
#TwentyGoto你的答案很好,但我不认为有人需要这样的实现。你想一次取消分配模板?什么发生在物品领域?所以#user1381319我认为你需要考虑其他的实现。 – 2014-01-11 10:24:28