I'm aware that page templates can be created using cshtml and can contain a custom Placeholder call (SfPlaceholder). However, I cannot add multiple placeholders to a page, and also don't understand how sub templates containing layout html can be created to be included in the page template.
Is there any documentation available on this? I'm presuming these basic features are possible?
Feather comes with a set of build in packages like Bootstrap, Foundation and SemanticUI that provide layouts out of the box:
When this layouts are added to the folder SitefinityWebApp\ResourcePackages we automatically generate for you a Sitefinity template based on the layout file(for the Bootstrap layout it is named “Bootsrap.default”). This page templates are editable and you can customize them by dragging controls to them.
In Feather we provide set of grid widgets that could be used to order the controls over your template. The grid widgets are available inside the “Bootstrap grid widgets”. You can find more details about this grid widgets here.
You can create your own grid widgets like described in this article:
For additional reference check the attached screenshot with sample bootstrap based template.
Brilliant, that was what I was looking for - thank you.
Some further questions...
Can Widgets be embedded with code directly into the layouts? To save content editors from dragging a 'header widget' onto the page, I'd like it always to be there.
Can widgets be restricted to certain columns, or quantities within these columns?
You can add a control to your pages in code like this:
PageManager pageManager = PageManager.GetManager();
var pageNode = pageManager.GetPageNodes().Where(p => p.Title == "MyTitle").FirstOrDefault();
if (pageNode != null)
var pageDataId = pageNode.PageId;
var page = pageManager.EditPage(pageDataId, CultureInfo.CurrentUICulture);
//add web forms widget
var blogsWidget = new Telerik.Sitefinity.Modules.Blogs.Web.UI.BlogPostView();
var blogsWidgetControl = pageManager.CreateControl<
blogsWidgetControl.Caption = "BlogPostWidget";
//end add web forms widget
//add MVC widget
var mvcWidget = new Telerik.Sitefinity.Mvc.Proxy.MvcControllerProxy();
mvcWidget.ControllerName = "ContentBlock.Mvc.Controllers.ContentBlockController";
mvcWidget.Settings = new Telerik.Sitefinity.Mvc.Proxy.ControllerSettings(new ContentBlockController()
var draftControlDefault = pageManager.CreateControl<
draftControlDefault.Caption = "Content block";
//end add MVC widget
//publishes draft page
This sample code displays how you can add web forms widget or MVC widget to a page. If your page is based on pure MVC template (like Bootstrap) you are allowed to add MVC widgets only to it.
In this snippet you should change the type of the control that you are adding to MvcProxyWidget and the placeholder where you place it. You can check the id of the placeholder in your browser tools by inspecting the gird widget output (see the attached screenshot). The name of the placeholder is available the part of the id starting with “Contentplaceholder”of the sf_colsIn element.
Where would this code go? I would want the widget to already be on the page at the time of it's creation.
Also, any ideas on limiting place holders to certain numbers or types of widget?