- สร้างไฟล์ install
o ดึงความสามารถของ phpBB มาใช้งาน
โค้ด: เลือกทั้งหมด
<?php
define('UMIL_AUTO', true);
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
$user->session_begin();
$auth->acl($user->data);
$user->setup();
if (!file_exists($phpbb_root_path . 'umil/umil_auto.' . $phpEx))
{
trigger_error('Please download the latest UMIL (Unified MOD Install Library) from: <a href="http://www.phpbb.com/mods/umil/">phpBB.com/mods/umil</a>', E_USER_ERROR);
}
// ……………………คำสั่งใน สร้างตาราง……………………………
include($phpbb_root_path . 'umil/umil_auto.' . $phpEx);
?>
- คำสั่งในการสร้างตาราง table_add
-table_column_add เพิ่ม ฟิลด์ในตาราง
โค้ด: เลือกทั้งหมด
$mod_name = 'TEST';
$version_config_name = 'TEST';
$versions = array (
'0.0.1' => array (
'config_add' => array( // การกำหนด
array('rt_number', 6),
array('rt_page_number', 0),
array('rt_anti_topics', 0),
array('rt_index', 1),
),
'table_add' => array (
array ($table_prefix . 'test',
array (
'COLUMNS' => array (
'rank_id' => array (
'UINT:8',
null,
'auto_increment'
),
'rank_title' => array (
'VCHAR',
''
),
'rank_min' => array (
'UINT:8',
'0'
),
'rank_special' => array (
'UINT:1',
'0'
),
'rank_image' => array (
'VCHAR',
''
),
),
'PRIMARY_KEY' => array (
'rank_id'
),
'KEYS' => array (
'rank_id' => array (
'INDEX',
array (
'rank_id'
)
),
),
),
),
),
),
'0.1.0' => array(
'table_column_add' => array(
array($table_prefix . 'test', 'forum_recent_topics', array('TINT:1', 1)),
),
),
);