Skip to content

officert/CmsLite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CmsLite

CmsLite is a Content Management System built on .NET MVC4. It allows you to create strongly typed templates using controllers, actions, and models. Write your templates in Visual Studio and CmsLite will turn them into templates to use in your CMS.

Section Templates from Controllers

A section template allows you to create Section Nodes within your CMS. A Section Node is a folder used to group together Page Nodes for your website. Any MVC ActionResults in your Controller that are marked up with the CmsPageTemplate attribute will generate Page Templates.

[CmsSectionTemplate(Name = "Home Template")]
public class HomeController : CmsController
{
    public HomeController(IActionInvoker actionInvoker, ICmsModelHelper cmsModelHelper) : base(actionInvoker, cmsModelHelper)
    {
    }
}

Page Templates from Actions

Page templates are generated for every method in a controller that has a return type = ActionResult. A page template allows you to create Page Nodes within your CMS. A Page Node represents a page in your website. When viewing a Page Node in the CMS you will see the various property editors for that page.

[CmsPageTemplate(
    Name = "Home Template",
    ModelType = typeof(HomeModel)
)]
public override ActionResult Index()
{
    var model = CmsModelHelper.GetModel<HomeModel>(HttpContext);
    return View(model);
}

Property Templates from Model properties

[CmsModelProperty(
    DisplayName = "Title",
    PropertyType = CmsPropertyType.TextString,
    Description = "The title of this page.",
    TabName = "General",
    TabOrder = 1
    )]
public string Title { get; set; }