[DefaultValues("IsEnabled", true, "IsSearchable", true, "DisplayInMenu", DisplayInMenu.Public)]

Introduction

lemoon 4 cms is a web content management system. This simply means that you easily can manage the content on your web site with lemoon 4. So, what is content? Content is more or less everything you see on every web site out there on the internet today, includning text, images links and so on. All content on a lemoon 4 web site is handled through something called a Content Type. A content type can be anything you want it to be. Here are some examples:

  • Product - A product including fields like article number, a preamble text, a product image and so on
  • Spot - A spot on the start page showing for example events, news
  • News - A news containing an image, a teaser text and a full news text
  • and so on...

Creating Content Types

All content types are defined in code (.cs or .vb). If you are working with a Visual Studio Web Application project you just need to include the file in your project. You can also create a separate class library (.dll) with your content types and reference that in your Web Application Project. If you are working with a Visual Studio Web Site you can place the code files in the App_Code folder. All content types created in either way are always available in the lemoon administration interface.

A Content Type must inherit from the StandardContent class. The StandardContent class includes all standard properties like Title, Created etc. Look att the simple example of a News Content Type below.

namespace ContentTypes {

    /// <summary>
    /// Content type representing a news.
    /// </summary>
    [Serializable]
    [Author("Mindroute Software")]
    [Render(Description = "Content type for news", Name = "News")]
    [DefaultValues("IsEnabled", true, "IsSearchable", true, "DisplayInMenu", DisplayInMenu.Public)]
    public class News : StandardContent {

        /// <summary>
        /// The news image
        /// </summary>
        [Persisted]
        [DataType("File")]
        public ContentRef NewsImage {
            get;
            set;
        }

        /// <summary>
        /// The news text.
        /// </summary>
        [Persisted]
        [DataType(DataType.Html)]
        [UIHint("Html", null, "width", "700px", "height", "200px")]
        public string NewsText {
            get;
            set;
        }

    }
}

The Content Type class defines two properties, NewsImage and NewsText. This will allow the editor who creates a new News page to select an image and write a news text. Look at the image below (image 1) how this is displayed in the administration interface.


image 1. News page content type in administration interface

And here's another example of a Product Content type.

namespace ContentTypes
{

    /// <summary>
    /// Content type representing a product.
    /// </summary>
    [Serializable]
    [Author("Mindroute Software")]
    [Render(Description = "Content type for products", Name = "Product")]
[DefaultValues("IsEnabled", true, "IsSearchable", true, "DisplayInMenu", DisplayInMenu.Public)]

    

    public class Product : StandardContent
    {

        /// <summary>
        /// The product preamble text.
        /// </summary>
        [Persisted]
        [DataType(DataType.Html)]
        [UIHint("Html", null, "width", "700px", "height", "150px")]
        public string ProductPreamble
        {
            get;
            set;
        }

        /// <summary>
        /// The product description.
        /// </summary>
        [Persisted]
        [DataType(DataType.Html)]
        [UIHint("Html", null, "width", "700px", "height", "150px")]
        public string ProductDescription
        {
            get;
            set;
        }

        /// <summary>
        /// If the product is in stock
        /// </summary>
        [Persisted]
        public bool InStock
        {
            get;
            set;
        }

        /// <summary>
        /// The product category.
        /// </summary>
        [Persisted(DefaultValue = "none")]
        [UIHint("Radio", null, "None", "none", "DVD", "dvd", "BD", "bd", "CD", "cd")]
        public string Category
        {
            get;
            set;
        }

    }
}

And here is what it looks like in the administration interface (image 2)


image 2. Product page content type in administration interface

There are no comments on this page.
createnews.png
createproduct.png
   
 

Customize this section

The widgets presented in this column can be added, removed and sorted - just click the icons to the right of the caption.
 
     
   
 

Working copies