การสร้าง ตารางด้วย Automod

สำหรับผู้ที่ เริ่มต้น Programming - PHP มีอะไร แนะนำ หรือข้อสงสัยต้องบอร์ด นี้ คนที่มีความรู้ แบ่งปันคนอื่นบ้างนะ ปัญหาการเขียนโปรแกรม แบบ OOP Session Cookies php network

Moderator: mindphp, ผู้ดูแลกระดาน

ภาพประจำตัวสมาชิก
thatsawan
PHP VIP Members
PHP VIP Members
โพสต์: 28508
ลงทะเบียนเมื่อ: 31/03/2014 10:02 am
ติดต่อ:

การสร้าง ตารางด้วย Automod

โพสต์ที่ยังไม่ได้อ่าน โดย thatsawan »

การสร้าง ตารางด้วย Automod
- สร้างไฟล์ 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);
 ?>
- คำสั่งในการกำหนด config_add กำหนดใน version
- คำสั่งในการสร้างตาราง 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)),
    ),
    ),
    );
- คำสั่งการกำหนด ค่า confic
ตอบกลับโพส

ผู้ใช้งานขณะนี้

สมาชิกกำลังดูบอร์ดนี้: ไม่มีสมาชิกใหม่ และบุคลทั่วไป 104