:::

2-5-1 完成顯示活動

您沒有觀看影片的權限

您沒有觀看影片的權限

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

  1. 之前新增完活動會自動轉向,並將新的流水號 id 傳到 index.php 本身
    //新增資料
    case 'tad_signup_actions_store':
        $id = Tad_signup_actions::store();
        header("location: {$_SERVER['PHP_SELF']}?id=$id");
        exit;

     

  2. 一般在switch中,我們將顯示放在 default 中,當有 $id 時用 Tad_signup_actions::show($id); 來顯示活動單一內容
    default:
        if (empty($id)) {
            Tad_signup_actions::index();
            $op = 'tad_signup_actions_index';
        } else {
            Tad_signup_actions::show($id);
            $op = 'tad_signup_actions_show';
        }
        break;

     

  3. 編輯 class/Tad_signup_actions.php 中的 Tad_signup_actions 類別下的 show()
    //以流水號秀出某筆資料內容
    public static function show($id = '')
    {
        global $xoopsDB, $xoopsTpl;
    
        if (empty($id)) {
            return;
        }
    
        $id = (int) $id;
        $data = self::get($id);
    
        $myts = \MyTextSanitizer::getInstance();
    
        foreach ($data as $col_name => $col_val) {
            //過濾讀出的變數值
            if ($col_name == 'detail') {
                $col_val = $myts->displayTarea($col_val, 0, 1, 0, 1, 1);
            } else {
                $col_val = $myts->htmlSpecialChars($col_val);
            }
            $xoopsTpl->assign($col_name, $col_val);
        }
    }

     

link to https://github.com/tadlearn/tad_signup/commit/99e5eeeee8c275f1212a4fdbdd97df4ed65659f7 \


:::

搜尋

QR Code 區塊

https%3A%2F%2Fwww.tad0616.net%2Fmodules%2Ftad_book3%2Fpage.php%3Ftbsn%3D48%26tbdsn%3D1607

書籍目錄

展開 | 闔起

線上使用者

247人線上 (6人在瀏覽線上書籍)

會員: 0

訪客: 247

更多…