:::

4-2-2 訪客的能看到的東西

您沒有觀看影片的權限

您沒有觀看影片的權限

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

  1. 目前首頁活動列表只有管理員才會顯示「編輯活動」按鈕,只有登入者才顯示「立即報名」,那訪客呢?
  2. 有兩種作法,一是訪客就不出現「功能」欄,另一種是就顯示不關痛癢的「詳情」按鈕即可。
    <{if $action.number > $action.signup|@count && $xoops_isuser && $action.end_date|strtotime >= $smarty.now}>
        <a href="index.php?op=tad_signup_data_create&action_id=<{$action.id}>" class="btn btn-info btn-sm"><i class="fa fa-plus" aria-hidden="true"></i> 立即報名</a>
    <{else}>
        <a href="index.php?id=<{$action.id}>" class="btn btn-success btn-sm"><i class="fa fa-file" aria-hidden="true"></i> 詳情</a>
    <{/if}>

     

  3. 至於活動詳情的報名表,理論上,為了保護個資,我們必須隱去一些資訊,例如名字可能要去掉中間字,其他資訊可能要隱藏起來。
    <{foreach from=$signup item=signup_data}>
    <tr>
        <{foreach from=$signup_data.tdc key="col_name" item=user_data}>
            <td>
                <{foreach from=$user_data item=data}>
                    <{if !$xoops_isuser && strpos($col_name, '姓名')!==false}>
                        <div><{$data|substr_replace:'O':3:3}></div>
                    <{elseif !$xoops_isuser}>
                        <div>****</div>
                    <{else}>
                        <div><{$data}></div>
                    <{/if}>
                <{/foreach}>
            </td>
        <{/foreach}>
        <td><{$signup_data.signup_date}></td>
    </tr>
    <{/foreach}>

     

  4. strpos(string $haystack, mixed $needle, int $offset = 0):用來查找有無指定字串(或說字串起始位置在那?當傳回false表示沒有該字串),詳情請參考:https://www.php.net/strpos
  5. substr_replace(mixed $string, mixed, $replacement, mixed $start, mixed $length ):用來取代指定位置的字串,詳情請參考:https://www.php.net/substr_replace

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

 


:::

搜尋

QR Code 區塊

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

書籍目錄

展開 | 闔起

線上使用者

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

會員: 0

訪客: 33

更多…