Content parts vs content types

Nov 17, 2010 at 10:22 AM

I thought I understood this, but now I'm not sure. So, what is the dfference between a content part and a content type?

Nov 17, 2010 at 11:10 AM

A content type can contain multiple content parts, but only one of each content part definition (eg. a blogpost can contain one comments content part and one body part).

Nov 17, 2010 at 4:50 PM

I think if you are a programmer, then you can view a content type as being an aggregate class definition.

Nov 17, 2010 at 5:28 PM

An explanation can be found here:

Nov 19, 2010 at 4:28 PM

Think I've got my head round it now. Thanks for the help and links.

Some documentation on working with data would be really useful. Unless there is some that I've missed. When should you rely on the handlers to do it for you automatically and how can you do it yourself using the ContentManager. Been struggling with this the last few days, but think I'm almost getting there.

Nov 20, 2010 at 7:30 PM

The doc says: "fields on a part are a dictionary of strings to values of the field's type, whereas the content type is a list of part types"

So what is the structure when a content type has a field? Will the field be wrapped in a part to attach to a content type?

Also, can a field have more than one value? For example a name and a url, each validated separately?


Nov 20, 2010 at 9:54 PM

Yes, a field is attached to a part technically.

And yes, you can have multiple values. That's why the Storage propoerty is indexed by name. The default text field has only one value, and the index is null. Internally it save the content to the innerText of an xml node. You can also define settings to customize the behavior of the value. Take a look at DateTimeField and TaxonomyField (in the taxonomy module) for more examples.

Nov 21, 2010 at 11:43 PM
Edited Nov 22, 2010 at 3:28 AM

Great... it took me a little while to realize I could use Storage.Set<T>(string name, T value). So what are the possible T types other than string? I tried a simple custom type and it didn't work.