Форумы / Cotonti / Core Labs / Archive / Extra fields

Description and API

medar
#2906 03.01.2009 15:04
First version (extra field for pages) was created in changeset 128.

In changeset 240 i do this system more flexible for future tasks.

Extra fields may be added for any sql table now.
Table sed_extra_fields contains properities for extra fields (html displaying - column field_html, location of extra field (for example - "pages", "users") - column field_location).

Tags for output extra fields not contains _MY_ now.

If you create extra field "release_data" for pages, you can use the following tags on pages:
On page.*.tpl: {PAGE_RELEASE_DATA}
On page.add.*.tpl: {PAGEADD_FORM_RELEASE_DATA}
On page.edit.*.tpl: {PAGEEDIT_FORM_RELEASE_DATA}

If you create extra field "jabber" for users, you can use the following tags on pages:
On users.profile.tpl: {USERS_PROFILE_JABBER}
On users.edit.tpl: {USERS_EDIT_JABBER}
On users.details.tpl: {USERS_DETAILS_JABBER}

Default extra fields (extra1 - extra5 for pages and extra1 - extra9 for users) added to database and avaiable for editing/deleting.

API:
sed_extrafield_add($sql_table, $name, $type, $html, $variants="", $description="");
sed_extrafield_update($sql_table, $oldname, $name, $type, $html, $variants="", $description="");
sed_extrafield_remove($sql_table, $name);
returns true if success and false if not.

$sql_table - name of table, without "sed_" prefix.
$type - now supported "input", "textarea", "select", "checkbox"

Example:
sed_extrafield_add('pages', 'release_data', 'input', '<input class="text" type="text" maxlength="255" size="56" />', '', 'this is data of album release');
rangjungyeshe.ru
Отредактировано: medar (03.01.2009 15:13, 16 лет назад)