The Plugin Custom Extrafields for Pages module of Cotonti CMF

The plugin changes the storage strategy: a physically independent cot_xtradbrowpage table is created for all extrapoles registered through it.

Filed under: Cotonti Engine

Complete Guide

What the Plugin Does

  • Creates a separate table cot_xtradbrowpage to store extra fields for pages. Each record is linked to a page via itempagid = page_id with cascading delete.
  • Registers the cot_xtradbrowpage location in the admin panel under "Extensions → Extrafields".
  • When editing a page, automatically outputs all active extra fields of this location (form fields with the rxtra_ prefix, tags {PAGEEDIT_FORM_XTRA_FIELDNAME}). Saves them on page update.
  • On the page view, provides tags {XTRA_FIELDNAME}, {XTRA_FIELDNAME_TITLE}, {XTRA_FIELDNAME_VALUE}, and a block <!-- BEGIN: XTRA_EXTRAFLD --> to loop through all fields.
  • In page lists (via cot_generate_pagetags()), tags with the prefix {LIST_ROW_XTRA_...} are available.
  • In the <head> section (header.tags hook), you can use {XTRA_HEADER_FIELDNAME}.
  • When a page is deleted, the corresponding record in cot_xtradbrowpage is removed either by cascade or explicitly (page.edit.delete.done hook).
  • Provides three API functions for manual operations.

Requirements

  • Cotonti 0.9.26+
  • PHP 8.4+
  • The "page" module must be installed

 permanent link to the current plugin source code on GitHub 

 

Installation

  1. Copy the plugin folder to /plugins/xtradbrowpage.
  2. In the admin panel, go to "Extensions → Plugins" and click "Install".

Installation SQL (executed automatically):

CREATE TABLE IF NOT EXISTS `cot_xtradbrowpage` (
    `itempagid` int UNSIGNED NOT NULL,
    PRIMARY KEY (`itempagid`),
    CONSTRAINT `fk_xtradbrowpage_pages` FOREIGN KEY (`itempagid`) REFERENCES `cot_pages` (`page_id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

Adding Extra Fields

  1. In the admin panel: "Extensions → Extrafields".
  2. Select the cot_xtradbrowpage location (appears after plugin installation).
  3. Create fields of the required types. Allowed types: input, textarea, select, datetime, double, and any others supported by the Cotonti core.

Example Field Set (from database dump)

Field NameTypeHTML TemplateVariants / ParametersDescription
event_nameinput<input class="form-control" type="text" name="{$name}" value="{$value}" maxlength="255"> Event name
event_descriptiontextarea<textarea class="form-control" name="{$name}" rows="{$rows}" cols="{$cols}" maxlength="255">{$value}</textarea> Event description
event_startdatetime<div class="row g-2"> ... </div> (See the partial SQL Dump)2024,2030,d.m.Y H:iEvent start
event_ticketpricedouble<input class="form-control" type="text" name="{$name}" value="{$value}" maxlength="255"> Ticket price
event_sesonselect<select class="form-select" name="{$name}">{$options}</select>unknown,winter,summer,autumn,springSeason

Templates and Tags

1. Edit Form (page.edit.tpl)

Block for automatic output of all fields:

<!-- BEGIN: XTRA_EXTRAFLD -->
<div class="form-group">
    <label>{PAGEEDIT_FORM_XTRA_EXTRAFLD_TITLE}</label>
    {PAGEEDIT_FORM_XTRA_EXTRAFLD}
</div>
<!-- END: XTRA_EXTRAFLD -->

Individual fields (example for event_name):

<div class="mb-3">
    <label>{PAGEEDIT_FORM_XTRA_EVENT_NAME_TITLE}</label>
    {PAGEEDIT_FORM_XTRA_EVENT_NAME}
</div>

2. View Page (page.tpl)

Block for all fields:

<!-- BEGIN: XTRA_EXTRAFLD -->
<div class="extrafield">
    <strong>{XTRA_EXTRAFIELD_TITLE}:</strong>
    <span>{XTRA_EXTRAFIELD_VALUE}</span>
</div>
<!-- END: XTRA_EXTRAFLD -->

Individual field:

<!-- IF {XTRA_EVENT_START} -->
    <p>{XTRA_EVENT_START_TITLE}: {XTRA_EVENT_START}</p>
<!-- ENDIF -->

Values are formatted according to the field type (datetime will be formatted as d.m.Y H:i).

3. Page Lists (page.list.tpl, news.tpl, etc.)

Use tags {LIST_ROW_XTRA_FIELDNAME}, e.g.:

<!-- IF {LIST_ROW_XTRA_EVENT_NAME} -->
    <small>{LIST_ROW_XTRA_EVENT_NAME_TITLE}: {LIST_ROW_XTRA_EVENT_NAME}</small>
<!-- ENDIF -->

These tags are added via the pagetags.main hook inside the cot_generate_pagetags() function.

4. Head Section (header.tpl)

<!-- IF {XTRA_HEADER_EVENT_NAME} -->
    <meta name="event" content="{XTRA_HEADER_EVENT_NAME}">
<!-- ENDIF -->

API for Developers

Functions are located in /plugins/xtradbrowpage/inc/xtradbrowpage.functions.php.

Get all registered fields

$fields = xtradbrowpage_getExtrafields(); // array from Cot::$extrafields['cot_xtradbrowpage']

Load record for a page

$data = xtradbrowpage_load($page_id); // returns an associative array with field_name keys

Save (INSERT or UPDATE)

$values = [
    'event_name' => 'New event',
    'event_start' => 1715011200, // UNIX timestamp
    'event_ticketprice' => 100.50
];
xtradbrowpage_save($page_id, $values);

Plugin Hooks and Their Purpose

HookFileAction
admin.extrafields.firstxtradbrowpage.admin.extrafields.first.phpAdds the location to the extra fields whitelist
header.tagsxtradbrowpage.header.tags.phpAssigns XTRA_HEADER_* tags for the current page
page.edit.tagsxtradbrowpage.page.edit.tags.phpOutputs fields in the edit form and parses the XTRA_EXTRAFLD block
page.edit.update.donextradbrowpage.page.edit.update.done.phpSaves the submitted values to cot_xtradbrowpage
page.edit.delete.donextradbrowpage.page.edit.delete.done.phpExplicitly deletes the record for the page
page.tagsxtradbrowpage.page.tags.phpAssigns tags for the view page, parses the XTRA_EXTRAFLD block
pagetags.mainxtradbrowpage.pagetags.phpAdds LIST_ROW_XTRA_* tags to $temp_array

Practical Example: Creating Events

1. Adding Fields

Create fields through the admin panel: event_name, event_description, event_start, event_ticketprice, event_seson with the parameters from the table above.

2. Edit Template

<!-- In page.edit.tpl -->
<div class="card mt-3">
    <div class="card-header">Event Parameters</div>
    <div class="card-body">
        <!-- BEGIN: XTRA_EXTRAFLD -->
        <div class="mb-3">
            <label class="form-label">{PAGEEDIT_FORM_XTRA_EXTRAFLD_TITLE}</label>
            {PAGEEDIT_FORM_XTRA_EXTRAFLD}
        </div>
        <!-- END: XTRA_EXTRAFLD -->
    </div>
</div>

3. View Template

<!-- In page.tpl -->
<!-- IF {XTRA_EVENT_NAME} -->
<div class="event-details">
    <h2>{XTRA_EVENT_NAME}</h2>
    <!-- BEGIN: XTRA_EXTRAFLD -->
    <p><strong>{XTRA_EXTRAFIELD_TITLE}:</strong> {XTRA_EXTRAFIELD_VALUE}</p>
    <!-- END: XTRA_EXTRAFLD -->
</div>
<!-- ENDIF -->

4. List Output

<!-- In page.list.tpl inside LIST_ROWS block -->
<div class="list-item">
    <a href="{LIST_ROW_URL}">{LIST_ROW_TITLE}</a>
    <!-- IF {LIST_ROW_XTRA_EVENT_START} -->
        <span class="date">{LIST_ROW_XTRA_EVENT_START}</span>
    <!-- ENDIF -->
</div>

Field Type Specifics

  • datetime: stored as int (UNIX timestamp). In the edit form, dropdowns are provided. On output, formatted according to the field_params (e.g., d.m.Y H:i).
  • select: comma-separated values in field_variants; the selected value is saved as a string.
  • double: saved as a floating-point number.
  • All fields are escaped on output via cot_build_extrafields_data() and htmlspecialchars().

Notes

  • The plugin does not add columns to the cot_pages table.
  • If a page is created without immediately saving extra fields, the record in cot_xtradbrowpage will appear on the first update of the page via the edit form.
  • For bulk data insertion, use the xtradbrowpage_save() API function.
  • Cache clearing is not required, but if you encounter display issues, clear the cache in the admin panel.
Buy The Plugin Custom Extrafields for Pages module of Cotonti CMF at low prices. Online store offers to order The Plugin Custom Extrafields for Pages module of Cotonti CMF, view full description, detailed specifications, product photos and current prices with discounts


Rating based on reviews:
Stars received: 5
Total reviews: 1
Average rating: 5
4 minutes read

Reviews to products 1

Это что-то новенькое!

Тут описание плагина почитать, попутно понимаешь работу экстраполей. Еще не разобрался. желательно бы видео-урок какой-то сделать, потому, что сразу после установки плагина вообще не понятно куда тыкать и для чего. но за плагин спасибо

2026-04-24 17:26

Review answers
1
Было бы время на создание видео. Субьективно - плагин 🌋 в плане 🛟 !!
Тут перед тем, как начать работу с плагином, и что бы увидеть всю картину, как он, как инструмент, решает сотни задач, сначала нужно:
1 . хоть немного освоить работу с экстраполями;
2. После установки плагина, зашли по ссылке https://cotonti.local/admin/extrafields?n=cot_xtradbrowpage и "забили" (создали) нужны поля (примеры в дампе в репозитории).
3. прописали всё в шаблонах модуля страниц или шапки сайта - песня!
Как бонус - поля можно делать мультиязычными!!
Видео будет или нет, я не знаю, времени нет вообще. лучше пишите на форуме вопросы - там отвечу, если нужна помощь
Answered the review: webitproff Date posted: 2026-04-24 18:19

Add to Cart

Product has no downloadable file

 

Availability
Free

Featured articles for this product

Content author

webitproff

Offline

webitproff

Last logged: 2026-09-01 22:41

About me briefly
Support and development of web projects on the CMF Cotonti: private messengers via the website, open and closed small social networks, trading platforms and marketplaces, freelance and services exchange portal, catalogs of goods from wholesale suppliers, dropshipping platforms, online stores, and much more.
View developments and download
Public portfolio of my works and developments
Telegram for messages
@webitproff
Telegram channel
@s/aBuyFILE

Featured Products and Services

The "UsrAdminTools" plugin - User Administration Tools

The "UsrAdminTools" plugin - User Administration Tools

The plug-in "User Administration Tools" is a powerful enough extension for Cotonti, which allows the
Index36: Modern Theme for Cotonti CMF

Index36: Modern Theme for Cotonti CMF

Index36, a website theme for Cotonti, is a complete website management ecosystem. The main focus is
CleanCot - шаблон сайта для новичков CMF Cotonti v.0.9.26

CleanCot - шаблон сайта для новичков CMF Cotonti v.0.9.26

CleanCot - Современная тема на Bootstrap v.5.3.3 для CMF Cotonti v.0.9.26 без режима наследия, код

Recommended forum topics for this product

Плагин “Extrafields Page Custom” - знакомство и поддержка

Плагин “Extrafields Page Custom” - знакомство и поддержка

Введение в плагин кратко. Исходные сведения для работы с плагином. Обсуждение, вопросы, помощь и
#205 | Постов: 6 | Просмотров: 4933
Введение в экстраполя Cotonti (Кратко для понимания обсуждения)

Введение в экстраполя Cotonti (Кратко для понимания обсуждения)

Экстраполя (Extrafields, дополнительные поля) — это механизм Cotonti, позволяющий администратору
#202 | Постов: 1 | Просмотров: 1175
Экстраполя в Cotonti: полное руководство по типу «Список с множественным выбором» (checklistbox)

Экстраполя в Cotonti: полное руководство по типу «Список с множественным выбором» (checklistbox)

Данное руководство является продолжением серии статей о дополнительных полях (Extrafields) в Cotonti
#204 | Постов: 1 | Просмотров: 2282

Market PRO Storefront

CMS, Script and Engine - website of online storefront, online store of info products and digital goods. Different prices in different currencies per product. Online cryptocurrency payment for goods and services.