class untuk membuat form edit dan add contoh penggunaan ada di bagian bawah file
Contoh penggunaan:
echo _class('params',$params)->show();Sample $params untuk script diatas adalah:
$params = array(
'title' => 'Header of form or title',
'table' => 'bbc_content', // table utama yang akan digunakan oleh class 'params'
'text_id' => 'bbc_content_text', // jika table utama menggunakan fitur multi language
'config_pre' => array(), // Kumpulan input field yang ditampilkan SEBELUM config
'config' => $config, // kumpulan input field yang disimpan dalam satu field di table utama
'name' => 'params', // nama field dari table utama untuk menyimpan kumpulan field diatas
'config_post' => array(), // Kumpulan input field yang ditampilkan SETELAH config
'pre_func' => '', // nama function yang ingin dieksekusi sebelum menyimpan dalam database
'post_func' => '', // nama function yang ingin dieksekusi setelah database di simpan
'primary' => 'id', // nama primary field pada table utama yang biasanya adalah "id"
'id' => 0 // Integer ID dari table utama jika mode 'edit' ('0' jika add)
);
untuk 'config_pre', dan 'config_post' index dari Array yang dimasukkan adalah nama field yang harus tersedia pada table utama, sedangkan format dari Array sama seperti $config, dan berikut contoh membuat input field yang bisa anda aplikasikan untuk variable $config
$config = array(
'inputtext' => array(
'text' => 'Sample Text Input',
'tips' => 'text to display under the input in small font-size',
'add' => 'additional text after the input',
'help' => 'popup tips to display right after the title',
'type' => 'text', // type of input
'language' => true, // is input support multiple language, default value is false
'attr' => ' size="40"', // additional attribute for the input
'default' => 'insert default value',
'mandatory' => 1, // is this field must be filled in (compulsory). Eg. 1 or 0
'checked' => 'any' // validate input eg. 'any' / 'email' / 'url' / 'phone' / 'number'
),
'plain' => array(
'text' => 'Sample Plaintext',
'tips' => 'text to display under the input in small font-size',
'add' => 'additional text after the input',
'help' => 'popup tips to display right after the title',
'type' => 'plain',
'default' => 'this is the text'
),
'radio' => array(
'text' => 'Sample Radio input',
'tips' => 'text to display under the input in small font-size',
'add' => 'additional text after the input',
'help' => 'popup tips to display right after the title',
'type' => 'radio',
'delim' => " -- ",
'option' => array('yes', 'no'),
'default' => '0',
'mandatory' => 1, // is this field must be filled in (compulsory). Eg. 1 or 0
'checked' => 'any' // validate input eg. 'any' / 'email' / 'url' / 'phone' / 'number'
),
'select' => array(
'text' => 'Sample Select input',
'tips' => 'text to display under the input in small font-size',
'add' => 'additional text after the input',
'help' => 'popup tips to display right after the title',
'type' => 'select',
'is_arr' => true, // if this is true, user has multiple selection
'option' => array(1 => 'yes', 0 => 'no'),
'default' => 'no',
'mandatory' => 0, // is this field must be filled in (compulsory). Eg. 1 or 0
'checked' => 'any' // validate input eg. 'any' / 'email' / 'url' / 'phone' / 'number'
),
'checkbox' => array(
'text' => 'Sample Checkbox input',
'tips' => 'text to display under the input in small font-size',
'add' => 'additional text after the input',
'help' => 'popup tips to display right after the title',
'type' => 'checkbox',
'delim' => " -- ",
'option' => array(1 => 'yes', 0 => 'no'), // leave it empty or unset for one checkbox and value
'default' => 1,
'mandatory' => 0, // is this field must be filled in (compulsory). Eg. 1 or 0
'checked' => 'any' // validate input eg. 'any' / 'email' / 'url' / 'phone' / 'number'
),
'checkbox2' => array(
'text' => 'Sample Checkbox with one option',
'tips' => 'text to display under the input in small font-size',
'add' => 'additional text after the input',
'help' => 'popup tips to display right after the title',
'type' => 'checkbox',
'option' => 'activate',
'default' => 1,
'mandatory' => 0, // is this field must be filled in (compulsory). Eg. 1 or 0
'checked' => 'any' // validate input eg. 'any' / 'email' / 'url' / 'phone' / 'number'
),
'textarea' => array(
'text' => 'Sample textarea input',
'tips' => 'text to display under the input in small font-size',
'add' => 'additional text after the input',
'help' => 'popup tips to display right after the title',
'type' => 'textarea',
'language' => true, // is input support multiple language, default value is false
'default' => 'sfdghgfhg',// default value
'mandatory' => 0, // is this field must be filled in (compulsory). Eg. 1 or 0
'format' => 'none', // what format you want to use eg. none | code | html
'checked' => 'any' // validate input eg. 'any' / 'email' / 'url' / 'phone' / 'number'
),
'file' => array(
'text' => 'Sample input for single file',
'tips' => 'text to display under the input in small font-size',
'add' => 'additional text after the input',
'help' => 'popup tips to display right after the title',
'type' => 'file',
'default' => 'sfdghgfhg',
'path' => 'images/uploads/'
),
'files' => array(
'text' => 'Sample input for multiple files',
'tips' => 'insert files to uploaded',
'add' => 'additional text after the input',
'help' => 'popup tips to display right after the title',
'type' => 'files',
'default' => '',
'max' => '5',
'path' => 'images/upload'
),
'captcha' => array(
'text' => 'Sample captcha for validation',
'tips' => 'Insert shown code in image as validation',
'add' => 'additional text after the input',
'help' => 'popup tips to display right after the title',
'type' => 'captcha',
'match' => 0 // '1' for Case Insensitive
)
);
File Path: includes/class/params.php class untuk membuat form edit dan add contoh penggunaan ada di bagian bawah file
0 Comment
Post Your Comment