Custom Control with Custom Template / Resources (if available)
Greetings,
Hi Daniel,
Thank you for using our services.
Unfortunately such functionality does not come out of the box with Sitefinity and your idea of implementing this seems like the most convenient. The problem however is that you would have to override each control you want to achieve this for. For example you would need to override the news view control and get the current page. From the current page you can extract its template path and theme name:
protected override void CreateChildControls() SiteMapNode currentNode = SiteMapBase.GetCurrentProvider().CurrentNode; PageSiteNode node = (PageSiteNode)currentNode; PageNode page; if (node != null) page = App.WorkWith().Pages().Where(p => p.UrlName == node.UrlName).Get().First(); string masterPage = page.Page.Template.MasterPage; string theme = page.Page.Template.Theme; PageManager manager = PageManager.GetManager(); this.MasterViewDefinition.TemplatePath = "~/App_Data/Sitefinity/WebsiteTemplates/DefaultTemplate/ControlTemplates/News/ListView.ascx"; base.CreateChildControls();Greetings,
[Browsable(false)] public override string LayoutTemplatePath get if (Page.Master == null) return File.Exists(HttpContext.Current.Server.MapPath(customTemplateFile)) ? customTemplateFile : null;