網站程式設計-PHP
一、prod.php
- 複製 slider.php 成 prod.php
- 用 ctrl + h => slider.php 取代成 prod.php
- 將 templates/admin/theme.html 其中的 slider 的部份複制,貼至新檔
- 將 slider.php 取代成 prod.php 、 選單 取代成 商品 、輪播圖 取代成 商品
- 然後再貼回 templates/admin/theme.html
- 後台選單 nav.php 增加一項
	
<li><a href='prod.php'>商品管理</a></li>
	
- 商品管理 比 輪播圖管理 的表單,多了 1.下拉選單 2.日期選單 3.多行 4.網頁編輯器
 請參考:https://www.ugm.com.tw/modules/tad_book3/page.php?tbdsn=156
 請參考:https://www.ugm.com.tw/modules/tad_book3/page.php?tbdsn=142
二、修改
- 商品管理主要的資料表為「show_prod」
- 商品類別的資料表為「show_kind」其中「kind="kind_prod"」, 商品類別是由「kind.php」管理
- 商品圖片的資料表為「show_files」其中「col_name="prod"」
- 寫程式其實不難,請注意上面那三行的分析,就是精髓所在。
- 首先修改$TBL
	
#定義常用變數
$TBL['name']="show_kind";//資料表名稱
$TBL['kind']="slider_home";//分類
	=> #定義常用變數 $TBL['name']="show_prod";//資料表名稱 $TBL['kind']="kind_prod";//分類
- op_list 樣板
 取消原先的 網址、外連,增加 日期、價格、人氣
 https://www.ugm.com.tw/modules/tad_book3/page.php?tbdsn=218
- op_list() 函數
 date():http://www.w3school.com.cn/php/php_date.asp
 strtotime():http://www.w3school.com.cn/php/func_date_strtotime.asp
 https://www.ugm.com.tw/modules/tad_book3/page.php?tbdsn=219
- op_form 樣板
 https://www.ugm.com.tw/modules/tad_book3/page.php?tbdsn=220
- op_form()函數
 https://www.ugm.com.tw/modules/tad_book3/page.php?tbdsn=221
- op_insert()函數
 https://www.ugm.com.tw/modules/tad_book3/page.php?tbdsn=222
- op_show樣板
 https://www.ugm.com.tw/modules/tad_book3/page.php?tbdsn=223
- op_show()函數
 https://www.ugm.com.tw/modules/tad_book3/page.php?tbdsn=224
- op_update()函數
 https://www.ugm.com.tw/modules/tad_book3/page.php?tbdsn=225
- op_delete()函數
 https://www.ugm.com.tw/modules/tad_book3/page.php?tbdsn=226
三、前台
- index.php => op_list()
	
  $block_prod = get_block_prod();
	
- 
	get_block_prod() 
 https://www.ugm.com.tw/modules/tad_book3/page.php?tbdsn=227
- op_list 樣板(前台 index.php)
 https://www.ugm.com.tw/modules/tad_book3/page.php?tbdsn=228