:::

5-6-1 完成搜尋功能

您沒有觀看影片的權限

您沒有觀看影片的權限

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

  1. 這個搜尋,指的是站內搜尋。
  2. 修改 xoops_version.php
    //---搜尋---//
    $modversion['hasSearch'] = 1;
    $modversion['search'] = ['file' => 'include/search.php', 'func' => 'tad_signup_search'];
  3. 編輯 include\search.php,然後開始取代即可
    <?php
    //搜尋程式
    
    function tad_signup_search($queryarray, $andor, $limit, $offset, $userid)
    {
        global $xoopsDB;
        if (get_magic_quotes_gpc()) {
            foreach ($queryarray as $k => $v) {
                $arr[$k] = addslashes($v);
            }
            $queryarray = $arr;
        }
        $sql = "SELECT `id`,`title`,`action_date`, `uid` FROM " . $xoopsDB->prefix("tad_signup_actions") . " WHERE 1";
        if ($userid != 0) {
            $sql .= " AND uid=" . $userid . " ";
        }
        if (is_array($queryarray) && $count = count($queryarray)) {
            $sql .= " AND ((`title` LIKE '%{$queryarray[0]}%'  OR `detail` LIKE '%{$queryarray[0]}%' )";
            for ($i = 1; $i < $count; $i++) {
                $sql .= " $andor ";
                $sql .= "(`title` LIKE '%{$queryarray[$i]}%' OR  `detail` LIKE '%{$queryarray[$i]}%' )";
            }
            $sql .= ") ";
        }
        $sql .= "ORDER BY  `action_date` DESC";
        $result = $xoopsDB->query($sql, $limit, $offset);
        $ret = array();
        $i = 0;
        while ($myrow = $xoopsDB->fetchArray($result)) {
            $ret[$i]['image'] = "images/signup.png";
            $ret[$i]['link'] = "index.php?id=" . $myrow['id'];
            $ret[$i]['title'] = $myrow['title'];
            $ret[$i]['time'] = strtotime($myrow['action_date']);
            $ret[$i]['uid'] = $myrow['uid'];
            $i++;
        }
        return $ret;
    }
    

     

  4. 加入小圖示(16x16)可至 https://www.flaticon.com/ 下載
  5. 最後更新模組即可

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


:::

搜尋

QR Code 區塊

https%3A%2F%2Ftad0616.net%2Fmodules%2Ftad_book3%2Fpage.php%3Ftbdsn%3D1723%26tbsn%3D48

書籍目錄

展開 | 闔起

線上使用者

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

會員: 0

訪客: 33

更多…