acp--> m_thaipost_info.php
โค้ด: เลือกทั้งหมด
namespace ***\m_thaipost\acp;
if (!defined('IN_PHPBB'))
{
exit;
}
class m_thaipost_info
{
function module()
{
return array( //สร้าง menu เป็น modul ของเรา 1 หน้า
'filename' => '\***\m_thaipost\acp\m_thaipost_module', // เช็กด้วยชื่อตรงกับ acp เรารึป่าว
'title' => 'THAIPOST',
'version' => '1.0.0',
'modes' => array(
'm_test_config' => array('title' => 'MENU_CONFIG', 'auth' => '***/m_thaipost', 'cat' => array('BUTTON_LIKE_MOD')),
//'m_setting_enables_like' => array('title' => 'BUTTON_LIKE_SETTING', 'auth' => '***/m_button_like', 'cat' => array('BUTTON_LIKE_MOD')),
),
);
}
}
โค้ด: เลือกทั้งหมด
namespace ***\m_thaipost\acp;
class m_thaipost_module{
function main($id,$mode){
global $user, $request, $template, $config;
$this->page_title = 'ACP_THAI_POST'; //หัวเพจอยากให้ชื่ออะไรใส่ตรงนี้
$this->tpl_name = 'acp_m_thaipost'; //ใส่ชื่อ template (ไฟล์ html แต่ไม่ต้องใส่ .html)
// สร้างฟอร์ม //////
$user->add_lang_ext('***/m_thaipost','acp/info_acp_m_thaipost');
////// รับค่าจากฟอร์ม ////////////
add_form_key('mindphp/m_thaipost');
if($request->is_set_post('submit')){ // รับค่าจากปุ่มsubmit เฉพาะ method ที่เป็น post
$test_1 =$request->variable('load_birthdays',0); //form_id คือชื่อฟิล 0 คือรับค่าที่เป็นตัวเลข ถ้าไม่ใช่ตัวเลขใส่ '' ใส่ภาษาไทยใส่ true
// $test_2 =$request->variable('m_sample','',true);
// print_r($test_2);
// echo $test_2; exit();
$config->set('load_birthdays',$test_1); // การเรียกใช้
// $config->set('m_sample',$test_2);
}
/// การส่งค่าไป template //////////
$template->assign_vars(array(
'TEST_ACTION'=>$this->u_action,
'SAMPLE_1_ENABLE'=>$config['load_birthdays'], //ดึงค่าเก่ามาแสดง (update)
)
);
}
}