:::

6-8 過濾所有讀出的函數

  1. 過濾 show_action 函數
    //顯示單一活動
    function show_action($action_id)
    {
        global $xoopsDB, $xoopsTpl;
        $tbl               = $xoopsDB->prefix('actions');
        $sql               = "SELECT * FROM `{$tbl}` WHERE `action_id` ='{$action_id}'";
        $result            = $xoopsDB->query($sql) or web_error($sql);
        $action            = $xoopsDB->fetchArray($result);
        $myts              = MyTextSanitizer::getInstance();
        $action['title']   = $myts->htmlSpecialChars($action['title']);
        $action['content'] = $myts->displayTarea($action['content'], 1, 1, 1, 1, 0);
        $xoopsTpl->assign('action', $action);
    }
    
  2. 過濾 list_action 函數

    //顯示活動列表
    function list_action()
    {
        global $xoopsDB, $xoopsTpl;
    
        $tbl    = $xoopsDB->prefix('actions');
        $sql    = "SELECT * FROM `{$tbl}` WHERE `enable` ='1' AND `end_date` > now() ORDER BY `end_date` DESC";
        $result = $xoopsDB->query($sql) or web_error($sql);
        $myts   = MyTextSanitizer::getInstance();
        while ($action = $xoopsDB->fetchArray($result)) {
            $action['title']   = $myts->htmlSpecialChars($action['title']);
            $action['content'] = $myts->displayTarea($action['content'], 1, 1, 1, 1, 0);
            $actions[]         = $action;
        }
        $xoopsTpl->assign('actions', $actions);
    }

:::

書籍目錄

展開 | 闔起

https%3A%2F%2Fcampus-xoops.tn.edu.tw%2Fmodules%2Ftad_book3%2Fpage.php%3Ftbsn%3D29%26tbdsn%3D886

計數器

今天: 1834183418341834
昨天: 2557255725572557
總計: 7145376714537671453767145376714537671453767145376