:::
主內容區域
9. 建立前台功能
- 開啟
index.php,此為模組前台首頁 - 我們要在這裡列出所有資料
- 有了前面的基礎,這裡就一口氣將之設定完(其實就是從main.php 複製過來就差不多完成90%了)
$Model = new TadModData('my_action'); $clean = $Model->clean(); $cate_arr = $Model->get_arr('my_action_cate', 'cate_id', 'cate_title'); $enable_arr = [1 => '啟用', 0 => '關閉']; $Model->set_file('action_id'); $Model->replace('cate_id', $cate_arr); $Model->replace('enable', $enable_arr); $Model->uid_name(); $Model->disable('action_id', ['index', 'show']); $Model->disable('action_title', ['show']); $Model->disable('action_content', ['index']); $Model->set_link('action_title', '', ['op' => 'show', 'action_id']); $Model->pagebar(10); switch ($op) { ...略... default: $Model->index(); break; } - 接著進行樣板設定的部份:
- 將
templates/下op_main_xxx.tpl等四個實體檔案複製一份,並重新命為op_index_xxx.tpl即可。 -
其中列表頁
op_index_show.tpl稍微改個標題<{$toolbar}> <h2 class="my">可報名活動列表</h2> <{$my_action_index}>
- 其中單一活動頁
op_index_index.tpl更直接拿活動名稱來當作標題<{$toolbar}> <h2 class="my"><{$my_action.action_title}></h2> <{$my_action_show}>
- 將
8-5 加上分頁