Creating a new document type

Any PHP script can be a document type (abbreviation "doctype") in AWF. That makes it very flexible, but you have to do a bit of configuration and every doctype has to care about rendering itself.

If you want to create a new doctype, follow these steps:

1) Create a new doctype script in inc/doctypes/ or look for one that already fits your needs e.g. smarty.inc, which simply calls smarty and does nothing else:


$smarty->display('doctypes/'.$awf->cms->documents->
 current_document->as_array['smarty_template']
 .'.'.OUTPUT_FORMAT.'.tpl', FINGERPRINT);

2) Add your doctype on admin/doctypes.php (click on the "Add Document Type"-tab): Label is the name that shall be displayed to the user, Name is AWF's internal name (please don't use spaces or special characters!), "Filename" is your filename (see 1) and type is normally "single" (if your doctype is a container for news or a weblog for example, choose "container" here). If you added the configuration to the comment header your doctype file, you can drop this step (name and value are tab separated):


<doctype>
label           Smarty Template Engine
name            smarty
author          Your Name
visible         1
license         GPL
version         1.00
description     Displays smarty templates.
type            single
documentation   http://www.awf-cms.org/
changed         18.01.2006
</doctype>

3) Click on save. If the popup window doesn't appear automaticaly, go to the doctype list and click on the edit icon of your new doctype. You can change all parameters afterwards here. As you might already have guessed, you'll need to define fields for your doctypes, so that the CMS knows what input fields to display. That can be done on the "Fields" tab.

To add a field, just enter label and name in the fields at the bottom and click on "Add". The details of your new field can be edited when clicking on the edit botton.

The "Data Type" defines, how the field content will be rendered (e.g. as Wiki code or HTML). Data types can be modified or added in the directory inc/datatypes/.

The "Input Type" defines, what input field will be displayed in the CMS (e.g. a text area or the Spaw WYSIWYG editor). Input types can be modified or added in the directory inc/inputtypes/.

You can also manage them on admin/doctypes.php (pages "Data Types","Add Data Type","Input Types" and "Add Input Type").

4) Your new doctype should now be available on admin/documents.php. You can change the doctype of an existing document on the Options page.

PDF version

Created: 08.01.2006 23:13 CET, Last Change: 24.01.2006 14:23 CET by admin

Login

or create a new account

Username


Password