multiple sites with N2 CMS

Topics: Developer Forum
Sep 3, 2008 at 11:29 AM
Hi,

I like N2 CMS, however i have a problem with multiple site option.
I added into C:\WINDOWS\system32\drivers\etc\hosts this 3 lines:
127.0.0.1 alpha.localhost.com
127.0.0.1 beta.localhost.com
127.0.0.1 gamma.localhost.com

I also add in web.config multipleSites="true" into <host> .

However, i cant find where i should put code bellow:

[N2.Definition("Start Page")]
[N2.Integrity.RestrictParents(typeof(RootPage))]
public class StartPage : TextPage, N2.Web.ISitesSource
{
    [N2.Details.EditableTextBox("Host", 100)]
    public virtual string Host
    {
        get { return (string)(GetDetail("Host") ?? string.Empty); }
        set { SetDetail("Host", value, string.Empty); }
    }

    public IEnumerable<N2.Web.Site> GetSites()
    {
        yield return new N2.Web.Site(Parent.ID, ID, Host);
    }

    public override string IconUrl
    {
        get { return "~/Edit/img/ico/page_world.gif"; }
    }
}

Can you pls help me?

Coordinator
Sep 3, 2008 at 6:22 PM
The code is the way to program a page that can be created on a site. It would make sense if you're implementing a custom CMS.

If you just want to try without coding you can download and set up the "compiled templates runtime". Once the site is up and running you can enter the domain name the start page nodes. Unfortunatly you'll need to restart the site before the changes takes effect.

Please share your experiences so I can improve the guide.