:::

6-2-3 勿用分頁功能來限制呈現數

您沒有觀看影片的權限

您沒有觀看影片的權限

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

  1. 用分頁功能來限制呈現數會受g2p變數影響而失準
  2. 修改 class\Tad_signup_actions.phpget_all()
    //取得所有資料陣列
    public static function get_all($only_enable = true, $auto_key = false, $show_number = 0, $order = ", `action_date` desc")
    {
        /*--略--*/
    
        $and_enable = $only_enable ? "and `enable` = '1' and `end_date` >= now() " : '';
    
        $limit = $show_number ? "limit 0, $show_number" : "";
        $sql = "select * from `" . $xoopsDB->prefix("tad_signup_actions") . "` where 1 $and_enable order by `enable` $order $limit";
    
        //Utility::getPageBar($原sql語法, 每頁顯示幾筆資料, 最多顯示幾個頁數選項);
        if (!$show_number) {
            $PageBar = Utility::getPageBar($sql, $xoopsModuleConfig['show_number'], 10);
            /*--略--*/
        }
    
        /*--略--*/$data_arr;
    }

     

  3. 修修改 class\Tad_signup_actions.php index()
    //列出所有資料
    public static function index($only_enable = true)
    {
        global $xoopsTpl, $xoopsUser;
    
        $all_data = self::get_all($only_enable);
        $xoopsTpl->assign('all_data', $all_data);
    
        /*--略--*/
    }

     

  4. 另外修改 templates\op_tad_signup_actions_index.tpltemplates\blocks\action_list.tpl,把 $xoops_isuser 的限制拿掉,避免誤解
    <{if $action.enable && $action.number > $action.signup|@count && $action.end_date|strtotime >= $smarty.now}>
        <i class="fa fa-check text-success" data-toggle="tooltip" title="報名中" aria-hidden="true"></i>
    <{else}>
        <i class="fa fa-times text-danger" data-toggle="tooltip" title="無法報名" aria-hidden="true"></i>
    <{/if}>
    <a href="<{$xoops_url}>/modules/tad_signup/index.php?id=<{$action.id}>"><{$action.title}></a>

     

link to https://github.com/tadlearn/tad_signup/commit/44df805126c7260845a3a8600fa90cf14d060bd3 \


:::

搜尋

QR Code 區塊

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

書籍目錄

展開 | 闔起

線上使用者

20人線上 (4人在瀏覽線上書籍)

會員: 0

訪客: 20

更多…