6-2-1
編輯區塊的設定函式
您沒有觀看影片的權限
請先登入,登入後,確認您的權限後,即可觀看影片。
- 編輯
blocks\action_list.php
,如:
// 可報名活動一覽的編輯函式
function action_list_edit($options)
{
$form = "
<ol class='my-form'>
<li class='my-row'>
<lable class='my-label'>顯示活動數</lable>
<div class='my-content'>
<input type='text' class='my-input' name='options[0]' value='{$options[0]}' size=6>
</div>
</li>
<li class='my-row'>
<lable class='my-label'>排序依據</lable>
<div class='my-content'>
<select name='options[1]' class='my-input'>
<option value=', `action_date` desc' " . Utility::chk($options[1], ', `action_date` desc', '1', "selected") . ">活動日期從遠到近</option>
<option value=', `action_date`' " . Utility::chk($options[1], ', `action_date`', '', "selected") . ">活動日期從近到遠</option>
<option value=', `end_date` desc' " . Utility::chk($options[1], ', `end_date` desc', '', "selected") . ">報名截止日期從遠到近</option>
<option value=', `end_date`' " . Utility::chk($options[1], ', `end_date`', '', "selected") . ">報名截止日期從近到遠</option>
</select>
</div>
</li>
</ol>
";
return $form;
}
Utility::chk()
的用法可參考:https://www.tad0616.net/modules/tad_book3/page.php?tbsn=15&tbdsn=1710
- 最外層表單
<ol class='my-form'>
<!--各種設定元件-->
</ol>
- 一般文字框
<li class='my-row'>
<lable class='my-label'>標題</lable>
<div class='my-content'>
<input type='text' class='my-input' name='options[編號]' value='{$options[編號]}' size=6>
</div>
</li>
- 下拉選單
<li class='my-row'>
<lable class='my-label'>標題</lable>
<div class='my-content'>
<select name='options[編號]' class='my-input'>
<option value='值1' " . Utility::chk($options[編號], '值1', '1', "selected") . ">選項1</option>
<option value='值2' " . Utility::chk($options[編號], '值2', '', "selected") . ">選項2</option>
</select>
</div>
</li>
- 單選框
<li class='my-row'>
<lable class='my-label'>標題</lable>
<div class='my-content'>
<input type='radio' name='options[編號]' value='值1' " . Utility::chk($options[編號], '值1', '', "checked") . ">選項1
<input type='radio' name='options[編號]' value='值2' " . Utility::chk($options[編號], '值2', '1', "checked") . ">選項2
</div>
</li>
- 大量文字框
<li class='my-row'>
<lable class='my-label'>標題</lable>
<div class='my-content'>
<textarea name='options[編號]' class='my-input'>{$options[編號]}</textarea>
</div>
</li>
- 複選框(這太複雜...有用到再說)
link to https://github.com/tadlearn/tad_signup/commit/87bbacc9b8dc313ab89701be7a56c1a7865dd75a \