案例:新增欄位至頁面管理
此例為新增一欄給 標題 使用。
後端 database.table add column
database: shop
table: mass_landing_profile
新增一個 seo_title 欄位:
程式修改
Model
$path: your_workspace/syf/mass/application/models/adminQQQ/page_management/Page_landing_model.php
無需異動。
View
$path: your_workspace/syf/mass/application/views/adminQQQ/page_management/page_landing.html
- 在標題 名稱設定 下方增加 SEO 標題
<th>SEO 標題</th> - 在值中新增以下 seo_title 必要欄位
<td class="click_to_edit">
<span><?=$landing_page->seo_title?></span>
<input type="hidden" id="landing_profile_seo_title_<?=$landing_page->id?>" name="seo_title" placeholder="請輸入 SEO 標題" value="<?=$landing_page->seo_title?>"/>
</td>
- 調整定義表格 filter 之 config
// tablesorter 中的 config
/*
headers: {
0: {sorter: false, filter: false},
3: {sorter: false, filter: false},
4: {sorter: false, filter: false},
10: {sorter: false, filter: false},
12: {sorter: false, filter: false},
}
修改為以下 */
headers: {
0: {sorter: false, filter: false},
3: {sorter: false, filter: false},
4: {sorter: false, filter: false},
11: {sorter: false, filter: false},
13: {sorter: false, filter: false},
}
- ajax 之左側選單 onclick event 修改
$path:
your_workspace/syf/mass/application/controllers/adminQQQ/templates/page_manage_category_nav.tmpl.php
/* 找到
if(id == 'empty_page_code'){
filter[ col = 3 ] = "/^$/";
}else if(id == 'empty_applied_by'){
filter[ col = 4 ] = "/^$/";
}else{
filter[ col = 4 ] = "/"+_major_cat_name+"\\W/";
}
更改為 */
if(id == 'empty_page_code'){
filter[ col = 3 ] = "/^$/";
}else if(id == 'empty_applied_by'){
filter[ col = 4 ] = "/^$/";
}else{
filter[ col = 4 ] = "/"+_major_cat_name+"\\W/";
}
到此完成。
Controller
$path: your_workspace/syf/mass/application/controllers/adminQQQ/page_management/Page_landing.php
無需異動。
其他
相關未來案例還有 刀模下載、製稿說明、Youtube ,
在維護的資料結構/性質相同的情況下,把著陸頁的 MVC 與 table 重製一份就好。
(但這樣就沒有組件複用...看開發需求)