Foren / Cotonti / Core Labs / Archive / Extra fields

Description and API

medar
#1 3. Januar 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

Dieser Beitrag wurde von medar (am 3. Januar 2009, 15:13, vor 15 Jahre) bearbeitet
esclkm
#2 3. Januar 2009, 17:31
wow!!! super !!! great work.
What I also do:
user_location user_irc user_msn user_icq user_website - I think that they are also must be editable extra_fields.

And may be description is also can be use: smth like this {PAGE_RELEASE_DATA_DESCRIPTION}

And what happened when I want to use new extra fields in USER_REGISTER,USERSLIST FORUM, PAGES -AUTORINFO )))
littledev.ru - мой маленький зарождающийся блог о котонти.
снижение стоимости программирования и снижение стоимости производства разные вещи. Первое можно скорее сравнить с раздачей работникам дешевых инструментов, чем со снижением зарплаты

Dieser Beitrag wurde von esclkm (am 3. Januar 2009, 17:54, vor 15 Jahre) bearbeitet
oc
#3 3. Januar 2009, 18:10
Maybe these are also should be editable (to me they should) but user_location vs. is used not only on the user profile, also forums etc. So I think they should stay, at least for now. Maybe later we can delete them, like in v1 or so.