PHP SMARTY 樣板引擎
20171206
一、安裝
- 下載 class/ugmKind.php 至 class/ 底下解壓縮
- 下載 class/treeTable 至 class/ 底下解壓縮
- 下載 admin_kind.php 至 ugm_p/ 底下解壓縮
- 下載 templates/bootstrap/tpl/admin_kind.tpl 至 ugm_p/templates/bootstrap/tpl/ 底下解壓縮
- templates/bootstrap/theme_admin.tpl
<{* 類別管理 *}>
<{elseif $WEB.file_name == "admin_kind.php"}>
<{include file="tpl/admin_kind.tpl"}>
-
二、使用
- admin_kind.php
#foreign key
$foreign = array(
"prod" => array("title" => "商品類別","stopLevel"=>1),
"news" => array("title" => "新聞類別","stopLevel"=>1),
"page" => array("title" => "頁面類別","stopLevel"=>1)
);
- admin_prod.php
#引入類別物件
include_once WEB_PATH . "/class/ugmKind.php";
#實體化 類別物件
$stopLevel = 1; //
$ofsn = 0;
$kind_tbl = "ugm_p_kind";
$kind_key = "prod";
//(資料表,分類,層數,父層)
$ugmKind = new ugmKind($kind_tbl, $kind_key, $stopLevel, $ofsn);
#---------------------------------
op_form($sn)
global $db,$smarty,$ugmKind;
$row['kind'] = isset($row['kind']) ? $row['kind']: "";
# true : enable = 1 才顯示
$row['kind_options'] = $ugmKind->get_kindOption($row['kind'],true);
-