How can I make customized content types?

How can I make customized content types?

« Back to Table of Contents

There are several different ways to make customized content types, depending on the amount of specialization you want:

to have a content type that holds the same information as an existing type, but looks different
You don't have to create a new class of objects at all. Instead, you can create a new Portal Type on your existing types. Under portal_types, just copy and paste an existing type (for example, copy "News Item", paste it, and rename it "Press Release"). Now you can modify the existing skins, as needed.
to create a new content type
the easiest way to create an entirely new type is to use Archetypes, an add-on to Plone 2.0 and an integral part of Plone 2.1. This lets you define a simple schema file. It is much more flexible than the first two options if your new type needs to have many new attributes, behaviors, etc.; however, it will involve installing a new product, having filesystem access to your Plone server, and restarting the Plone server. For some pointers, see the documentation overview. In particular, you may want to check out the ArchGenXML CASE tool, which lets you create content types using UML diagrams. The ArchGenXML tutorial should get you started.
to have a content type that holds similar information to existing types
You can base your new type on an existing type, but add new properties onto it. To do this, under portal_types, choose a Scriptable Type Information' type. You'll need to read documentation on how to use Scriptable Type Information, but this will let you define a custom creation script that can add any new desired attributes. Then, you can modify the scripts. For more advanced use cases, you may want to extend an Archetypes content type. The RichDocument tutorial shows you how to extend Plone 2.1's default content types.
(deprecated) use a ZClass
ZClasses were through-the-web, easy-to-use tool for creating new content types. Unfortunately, they have enough limitations that many people recommend not using them at all. If you're interested in ZClasses, you can read about them in the Zope Book
by Jean-Paul Ladage last modified Dec 30, 2008 03:00 PM
Contributors: Joel Burton
All content is copyright Plone Foundation and the individual contributors.

Good overview

Posted by Martin Aspeli at Oct 05, 2004 10:03 AM
Good overview here; I think we should also link to relevant documentation (e.g. the archetypes docs)

how ca i add users in bulk

Posted by purshi at Feb 16, 2005 06:18 AM
where to code the script in the plone site . i mean wher to place the code in ZMI

Hotel Content Using Archetypes

Posted by pravin satras at Aug 02, 2005 12:08 PM
//using archetypes we can creat own content for example hotel content//

//code is below ---save this in software/products/Archetypes/examples/Hotel.py
   and also modify init.py//

//add one line code in init.py---
   *import Hotel*

then restart zope then create hotel content type//


///code---Hotel.py///

from Products.Archetypes.public import *


schema = BaseSchema + Schema((

    ImageField("Hotel Image"),
    
    ObjectField("AddressLineOne",
                searchable=1,
                required=1),
    ObjectField("AddressLineTwo",
                searchable=1,
                required=1),
    ObjectField("AddressLineThree",
                searchable=1),

    ObjectField("Website"),

    LinesField("E-Mail"),

    LinesField("Contact No."),

    StringField("Contact Person"),
    
    TextField('Other Information',
              required=1,
              searchable=1,
              default_output_type='text/html',
              allowable_content_types=('text/plain',
                                       'text/restructured',
                                       'text/html',
                                       'application/msword'),
              widget = VisualWidget(description="""Enter or upload text for the Body of the document"""),
              ),
    ))


class Hotel(BaseContent):
    """A simple archetype"""
    schema = schema

registerType(Hotel)