[TYPO3] How to create my onw ctypes?

JoH info at cybercraft.de
Wed Mar 22 16:11:01 CET 2006


> I wanna write a bunch of ctypes and deactivate all others for a
> specific part of the pagetree. Configuration can be done via TCEFORM
> AFAIK, but
> how to write an extension that creates new ctypes?
> Where are they registered?
> How to tell Typo the way the input fields, lists, descriptions, acor
> point-selection, helper-texts have to be displayed in the backend?
>
> (Of course I could write an extension, serving the content via ctype
> plugin, but this is not the convenient way, because the texts etc
> should
> be stored in normal tt_content and easily editable via backend and
> searchable etc...or is there a way to do this with a normal plugin as
> well?)

Usually this can be done in  a few steps:

1.
Use the kickstarter to create the fields you need in addition to the
existing fields.
Try to use as many of the existing fields as possible. Header, bodytext and
others can be resued in almost any imaginable content element.
You don't need a plugin or something like that so leave this part.

2.
Now modify ext_tables.php and tca.php of this extension to setup the
different types and specify the fields to be listed in the BE form for each
type.
Info can be found in the core API docs.

3.
Create the corresponding TS-Setups and Constants for each type and save it
to static/setup.txt and static/constants.txt
TS Setup should be looking like this:

tt_content.myNewType = COA
tt_content.myNewType {
    # setup goes here
}

Since in CSS-styled-content and content(default) tt_content is a CASE
Element based on the key field CType, this will switch the setup
automatically based on the selection made in the BE form.

4.
Install the extension.

Not that easy but IMHO this is how it should be done.

Joey

-- 
Wenn man keine Ahnung hat: Einfach mal Fresse halten!
(If you have no clues: simply shut your knob sometimes!)
Dieter Nuhr, German comedian
openBC: http://www.cybercraft.de





More information about the TYPO3-english mailing list