views:

821

answers:

1

Hello,
I am trying to build my own CMS for myself and my clients. The system will mainly be used for small websites < 10 pages. For bigger project I will most likely use an existing system(MojoPortals, Umbraco, Kooboo). The reason why I want my own system is so that I have full control and also because existing systems are mostly bloated with features that I wont use anyway for smaller projects. I am also learning Asp.net Mvc so that's the other reason to build my own system.

These are some of the systems I tried(some more than others):

The one I liked right away was MojoPortals. Mostly because of the left-middle-right + modules system.

So my goals are to have a system where you can create pages and each page will have a left, middle and right placeholder for modules. The modules will be very basic(Text, Html, Image). The system also need to be easy to deploy and reuse.

I already started working on my system.

The page object looks like this:

public class Page
{
    public int PageID { get; set; }
    public string Name { get; set; }
    public string Description { get; set; }
    public string Title { get; set; }
    public IEnumerable<Module> Modules { get; set; }
}

The Module object looks like this:

public class Module
{
    public int ModuleID { get; set; }
    public string ModuleTitle { get; set; }
    public string ModuleType { get; set; }
    public string ModuleLocation { get; set; }
    public Dictionary<string, string> ModuleValues { get; set; }
}

This is how my View looks: www.codepaste.com

Later I will probably add a website object that holds info for which view(template) it will show.

The questions I have at the moment are mainly about the view. The view I linked has some basic code which first checks the module location and then shows all the module info in the right location. I would like that part to be easy reusable. So I thought of making a strongly typed partial view that does the left, right and middle stuff. Also for the modules I was thinking of using partial views and render the correct partial of a certain moduleType. So text will have a partial, html will have one and so on. I am not sure if this is the right technique.

So should I use a partial view to handle the left, middle and right stuff and use partial views to load the modules?

If somebody has other info about building a module based cms or techniques/structures that I can use that would be really great too.

Thanks in advance, Pickels.

A: 

Hi,

Yes, that's the best option. Set a "structural base" to each template with css, and make every module load his own views into the right template sections. Lets say you template has a top menu under the common header where you display companie's logo and stuff .. insert in the database the information about the module and about that top section of the template (you should totally create a table in the database about template structure, so the system can know where to put every module related with every page), and just use the system to get the module needed in every page request to the right position, making it load its own view(s) into that place.

Hope you understand my writing :)

yoda
I didn't really understand what you wrote.
Pickels
basically, make your comtroller / model load an array with the structural base of each page requested, and for each section found in the structure, you'd have a module associated.
yoda