:::

3-5-1 TadDataCenter 常用方法

您沒有觀看影片的權限

您沒有觀看影片的權限

請先登入,登入後,確認您的權限後,即可觀看影片。

  1. 記得先use該物件:
    use XoopsModules\Tadtools\TadDataCenter;

     

  2. 產生單一個表單欄位:
    $TadDataCenter = new TadDataCenter($module_dirname);
    $TadDataCenter->set_col($col_name, $col_sn);
    $form = $TadDataCenter->getForm($mode, $form_tag, $name, $type, $value, $options, $attr, $sort);

     

  3. 產生批次表單欄位:
    $TadDataCenter = new TadDataCenter($module_dirname);
    $TadDataCenter->set_col($col_name, $col_sn);
    $TadDataCenter->assignBatchForm($form_tag, $data_arr = array(), $type = '', $attr = []);

     

  4. 儲存資料:
    $TadDataCenter = new TadDataCenter($module_dirname);
    $TadDataCenter->set_col($col_name, $col_sn);
    $TadDataCenter->saveData();
    // 或
    $data_arr = [
        $data_name1 => [0 => $data_value1, 1 => $data_value2],
        $data_name2 => [0 => $data_value3],
    ];
    $TadDataCenter->saveCustomData($data_arr = []);

     

  5. 取得資料陣列:
    $TadDataCenter = new TadDataCenter($module_dirname);
    $TadDataCenter->set_col($col_name, $col_sn);
    $data = $TadDataCenter->getData($name, $sort = 0);
    $xoopsTpl->assign('data', $data);

    $data是二維陣列:$data['變數名稱1'][0]$data['變數名稱1'][1]...

  6.  刪除資料:
    $TadDataCenter = new TadDataCenter($module_dirname);
    $TadDataCenter->set_col($col_name, $col_sn);
    $TadDataCenter->delData($name, $sort);

     


:::

搜尋

QR Code 區塊

https%3A%2F%2Ftad0616.cp27.secserverpros.com%2Fmodules%2Ftad_book3%2Fpage.php%3Ftbdsn%3D1716%26tbsn%3D48

書籍目錄

展開 | 闔起

線上使用者

357人線上 (154人在瀏覽線上書籍)

會員: 0

訪客: 357

更多…