Anybody could explains all the folders in the template projects in details

Feb 21, 2009 at 8:48 PM
Edited Feb 21, 2009 at 8:57 PM
Hi, i was just wondering if somebody could explain to me in details why the template site hierarchy is this way and what those folder do exactly in the template site.

I saw that you explain very little in the documentation.

I currently have a simple html page + .css that i would like to convert into a n2 website.

So I'm wondering where to start and what to do. Anybody could write a tutorial on this

(how to convert a simple html + css to a working n2 website. (i'm sure it's not that complicated)

but it would be awesome to explain exactly how n2 work.

Maybe html+css -> website -> n2 would be a nice way to go for the convertion
Feb 22, 2009 at 10:20 AM
I think there's no strict prescriptions as to what to put where and why mainly because you are free to do whatever you like if you understand a few basic principles. To my understanding, these principles are:
 - there should be a data items -- a classes you derive from N2.ContentItem, which describe a shape of you data, as well as provide some meta-information (in a form of [Editable*] attributes) about how to enter this data via N2 Admin GUI. (I use to put such classes in a separate assembly)
 - also, for each data class there should be a view: either an .aspx page OR .ascx user control, which are assigned to data item either by overriding ContentItem.TemplateUrl property OR applying [Template("~/MyPage.aspx")] attribute to your data class. It is suggested to put these views into ~/Addons/YouSolution/UI folder (though, i often neglect this advice, risking to face an incompatibility with someone else's code oneday).
 - your data items form a tree-like hierarchy, that is stored in the database. This hierarchy drives a structure of your site. It is rendered with a help of a views you've defined on a previous step.
 - And finally about N2.Templates -- it is a sample implementation of a common CMS-related bits on a top of N2 (I believe, N2 core is capable of much more than driving a Web CMS, so i'd rather not limit your curiosity to digging exclusivelly in Templates tenets)
Feb 22, 2009 at 9:30 PM
Edited Feb 22, 2009 at 9:33 PM
thx for the reply, it's very helpful.

do you favor composition or inheritance with n2 and when/why?

Lets say I have a simple html page and a css style for fonts, layout, background, padding etc..

How to reproduce the same layout with N2 functionalities?
(my idea on this is to first do a master page with contentplaceholder in n2 zones) and afterwards use specifics controls in for the contentplaceholder) is this right??
what to do with the css layout values in the stylesheet??
Do i still use it on the masterpage to create the layout of the div???

Can you explain to me what the zone are use for exactly? Are zone for layout of items in a page?

has for the other presentations style values in the original stylesheet
(i would have to organise and split the css file in multiple file related to the place they are use, like the one needed everywhere in the master page and the specific one in the controls themselve) is this right??

Also, do you recommend using MVC for N2??

I have an error when opening the mvc demo project with visual studio 2008?? anybody have this.

You can say no to thi but would you esteewhy, take simple html page + css file and create a fully functionnal n2 website with it. ( just layout, pagetab, login to cms and news)
I know i should do this myself but its gonna take me 2-3 days just to do it while i'm sure somebody who knows the framework would do it very easily.

It would be awesome for me to be able to compare the one you send me with the template demo and the one you send me with the original .html and .css file.

Hehe I understand tho if you would refuse.

thx for helping in any case
Feb 23, 2009 at 10:34 AM
You've got it: [ ] -- a minimalistic N2 promotional package ;-) (sans Templates)

how t'was done..
prereq.: a working copy of n2cms svn repo (build it with Deploy_Everything-vs2008.bat -- you'll get .\output with everything you need)
1. Drop .\output\Templates\wwwroot\Edit into your newly created app (i've removed it from the promo package, thou shallt put it back; i use to use awesome NTFS Link to avoid wasting disk space for each of my 1e+6 n2-powered apps)
2. Reference assemblies (the same now at ~/bin)
3. Take default.aspx from .\output\Templates\wwwroot\ (just to not having to reinvent the wheel)
4. Take a web.config from there too (i've stripped it off Templates traces, but usually you want it to stay)

Ready !

5. There's a ready db in App_Data, but you can easily start all over again: start the app and navigate to ~/Edit/Install/
6. On 3rd step choose to recreate tables - this effectivelly wipe out the db
7. On 4th step select both [root] and [start] to be a single item available to you now: that's an 'Alex' (btw, for some reason you cannot select a 2nd option for root/start to be the same instance -- i believe it's a glitch, so you can report it to Cristian)

Sorry to be terse,  much work to do..
Feb 23, 2009 at 5:11 PM
Edited Feb 23, 2009 at 5:16 PM
thx a lot, no problem its nice of you to help me like this.

I actually travelled a little more in n2 functionalities and I know now a little more what is happening behind the box.

I was thinking of an idea!!

I would be nice to have an index.htm for n2Cms that would be use only to create n2cms themes.

This way we could work on the css outside of n2 and visual studio and just apply the theme once done. (IDs would need to be correctly mapped)

Actually, what would be even nicer would be that in the administrative page you would be able to export a simple .html + .css file from the current selected page.
this way you could use this .html directly just to work the css and you could merge the new css to the theme css or you could also do a checkin, uploading the new css on the page
and this css would be reapplied over the original page .css.

this is just an idea, i'm sure even better options could be available, to work themes easily. If anybody have ideas please post it :)

Feb 23, 2009 at 5:23 PM
Actually just a simple .html file that would be a .html version of the homepage would do perfectly to work themes.