Zum Inhalt springen

xoops_version.php - Modul-Manifest

Die Datei xoops_version.php ist das Herzstück jedes XOOPS-Moduls. Sie definiert Modul-Metadaten, Datenbanktabellen, Templates, Blöcke, Konfigurationsoptionen und Installations-Hooks.

<?php
/**
* Modul-Manifest-Datei
*/
$modversion = [
// Modul-Identität
'name' => _MI_MYMODULE_NAME,
'version' => '1.0.0',
'description' => _MI_MYMODULE_DESC,
'author' => 'Your Name',
'author_mail' => 'your@email.com',
'author_website' => 'https://yoursite.com',
'credits' => 'Contributors',
'license' => 'GPL 2.0 or later',
'license_url' => 'https://www.gnu.org/licenses/gpl-2.0.html',
'dirname' => basename(__DIR__),
// Bilder
'image' => 'assets/images/logo.png',
'modicons16' => 'assets/images/icons/16',
'modicons32' => 'assets/images/icons/32',
// System-Einstellungen
'system_menu' => 1,
'hasAdmin' => 1,
'adminindex' => 'admin/index.php',
'adminmenu' => 'admin/menu.php',
'hasMain' => 1,
'hasSearch' => 1,
'hasComments' => 0,
'hasNotification'=> 0,
];
SchlüsselTypBeschreibung
namestringAnzeigename (Sprachkonstante verwenden)
versionstringSemantische Version (MAJOR.MINOR.PATCH)
descriptionstringModul-Beschreibung
authorstringPrimär-Autorenname
creditsstringZusätzliche Mitwirkende
licensestringLizenzname
dirnamestringModul-Verzeichnisname
$modversion['sqlfile']['mysql'] = 'sql/mysql.sql';
$modversion['tables'] = [
'mymodule_items',
'mymodule_categories',
'mymodule_comments',
];
$modversion['templates'] = [
['file' => 'mymodule_index.tpl', 'description' => 'Index page template'],
['file' => 'mymodule_item.tpl', 'description' => 'Single item view'],
['file' => 'mymodule_category.tpl', 'description' => 'Category listing'],
];
$modversion['blocks'][] = [
'file' => 'blocks/recent.php',
'name' => _MI_MYMODULE_BLOCK_RECENT,
'description' => _MI_MYMODULE_BLOCK_RECENT_DESC,
'show_func' => 'mymodule_recent_show',
'edit_func' => 'mymodule_recent_edit',
'template' => 'mymodule_block_recent.tpl',
'options' => '10|0', // Standardoptionen
'can_clone' => true,
];
$modversion['config'][] = [
'name' => 'items_per_page',
'title' => '_MI_MYMODULE_ITEMS_PER_PAGE',
'description' => '_MI_MYMODULE_ITEMS_PER_PAGE_DESC',
'formtype' => 'textbox',
'valuetype' => 'int',
'default' => 10,
];
$modversion['config'][] = [
'name' => 'enable_comments',
'title' => '_MI_MYMODULE_ENABLE_COMMENTS',
'description' => '',
'formtype' => 'yesno',
'valuetype' => 'int',
'default' => 1,
];
$modversion['config'][] = [
'name' => 'display_mode',
'title' => '_MI_MYMODULE_DISPLAY_MODE',
'description' => '',
'formtype' => 'select',
'valuetype' => 'text',
'default' => 'list',
'options' => [
_MI_MYMODULE_MODE_LIST => 'list',
_MI_MYMODULE_MODE_GRID => 'grid',
],
];
formtypevaluetypeBeschreibung
textboxtext/intEinzeiliger Input
textareatextMehrzeiliger Input
yesnointJa/Nein Radio
selecttextDropdown-Select
select_multiarrayMulti-Select
groupintGruppen-Selector
group_multiarrayMulti-Gruppen-Selector
userintBenutzer-Selector
colortextFarbwähler
hiddentextVerstecktes Feld
// Haupt-Menü
$modversion['sub'][] = [
'name' => _MI_MYMODULE_SMENU_INDEX,
'url' => 'index.php',
];
$modversion['sub'][] = [
'name' => _MI_MYMODULE_SMENU_SUBMIT,
'url' => 'submit.php',
];
$modversion['onInstall'] = 'include/oninstall.php';
$modversion['onUpdate'] = 'include/onupdate.php';
$modversion['onUninstall'] = 'include/onuninstall.php';
$modversion['hasSearch'] = 1;
$modversion['search'] = [
'file' => 'include/search.php',
'func' => 'mymodule_search',
];
$modversion['hasComments'] = 1;
$modversion['comments'] = [
'itemName' => 'item_id',
'pageName' => 'item.php',
];
$modversion['hasNotification'] = 1;
$modversion['notification'] = [
'lookup_file' => 'include/notification.php',
'lookup_func' => 'mymodule_notify_iteminfo',
'category' => [
[
'name' => 'global',
'title' => _MI_MYMODULE_NOTIFY_GLOBAL,
'description' => '',
'subscribe_from' => 'index.php',
],
[
'name' => 'item',
'title' => _MI_MYMODULE_NOTIFY_ITEM,
'description' => '',
'subscribe_from' => 'item.php',
'item_name' => 'item_id',
],
],
'event' => [
[
'name' => 'new_item',
'category' => 'global',
'title' => _MI_MYMODULE_NOTIFY_NEW_ITEM,
'caption' => _MI_MYMODULE_NOTIFY_NEW_ITEM_CAP,
'mail_template' => 'notify_newitem',
'mail_subject' => _MI_MYMODULE_NOTIFY_NEW_ITEM_SUBJ,
],
],
];
  • Module-Development - Vollständiger Modul-Leitfaden
  • Module-Structure - Verzeichnisstruktur
  • Block-Development - Erstellen von Blöcken
  • Database-Operations - Datenbanksetup