本文整理匯總了PHP中Templates::Assign方法的典型用法代碼示例。如果您正苦於以下問題:PHP Templates::Assign方法的具體用法?PHP Templates::Assign怎麽用?PHP Templates::Assign使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Templates
的用法示例。
在下文中一共展示了Templates::Assign方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: edit
function edit($userid, $addrid)
{
$addrs = ReceiverAddress::getData($addrid);
$provinces = Countys::getCountys();
$n = isset($_REQUEST['n']) ? (int) $_REQUEST['n'] : 0;
Templates::Assign('n', $n);
Templates::Assign('addrs', $addrs);
Templates::Assign('provinces', $provinces);
Templates::Display('addressnew.html');
}
示例2: save
function save()
{
$ids = isset($_REQUEST['ids']) ? $_REQUEST['ids'] : array();
$order_code = isset($_REQUEST['order_code']) ? $_REQUEST['order_code'] : '';
$user_code = isset($_SESSION['user_code']) ? $_SESSION['user_code'] : '';
$bh_order_code = str_replace('SK', 'BH', $order_code);
$order_bh = Orders::getOne(array('order_code' => $bh_order_code));
if ($order_bh) {
$time = $order_bh['create_time'];
$time = date('Y-m-d H:i:s', $time);
Templates::Assign('errormsg', "訂單已在 {$time} 補過一次貨,不能再補貨了。");
Templates::Display('error.html');
exit;
}
$orders = Orders::getOne(array('order_code' => $order_code, 'order_status' => 5), 'id, order_status');
$order_status = isset($orders['order_status']) ? (int) $orders['order_status'] : 0;
if (!$orders) {
Templates::Assign('errormsg', "訂單未找到,請核對該訂單能補貨 ,訂單號: {$order_code}, order_status : {$order_status}");
Templates::Display('error.html');
exit;
}
DB::Debug();
DB::tranBegin('replen');
//事務開始
Orders::createBHOrder($order_code);
//生成補貨訂單
foreach ($ids as $id) {
$replen = OrdersBH::getData($id);
$qt = $replen['num'];
$sku = $replen['sku'];
$status = ProductsStock::outStockInsertOrderProduct($bh_order_code, $sku, $qt);
if (!$status) {
DB::rollBack();
Templates::Assign('errormsg', "補貨保存失敗,[{$sku}] 庫存不足,錯誤代碼 BH001");
Templates::Display('error.html');
exit;
}
OrdersBH::update($id, array('status' => 1));
}
$commit_status = DB::tranEnd('replen');
header("Location: /order/?order_code={$order_code}");
}
示例3: array
$tmp[$j] = $j;
}
}
$products[$i]['outstock'][] = array('product_num' => $products[$i]['product_num'], 'exp_date' => $products[$i]['exp_date']);
unset($products[$i]['product_num'], $products[$i]['exp_date']);
}
foreach ($tmp as $pk => $v) {
if (isset($products[$pk])) {
unset($products[$pk]);
}
}
ProductsSku::getProductsPic($products);
$orders[$k]['products'] = $products;
$status_name = OrdersStatus::getName($order['order_status']);
$orders[$k]['status_name'] = $status_name;
}
if ((int) $stardate > 0 && (int) $enddate > 0) {
$stardate = date('Y-m-d', $stardate);
$enddate = date('Y-m-d', $enddate);
}
Templates::Assign('stardate', $stardate);
Templates::Assign('enddate', $enddate);
Templates::Assign('keyword', $keyword);
Templates::Assign('paged', $paged);
Templates::Assign('orders', $orders);
Templates::Assign('ordercount', Orders::getUserOrderNum($user_code));
Templates::Assign('status', $status);
Templates::Assign('product_num', $product_num);
Templates::Assign('userlevel', $userlevel);
Templates::Assign('userinfo', $userinfo);
Templates::Display('home.html');
示例4: BCCL
function BCCL()
{
$user = isset($_SESSION['user']) ? $_SESSION['user'] : null;
if (!$user) {
header('Location: /');
exit;
}
$userid = isset($_SESSION['userid']) ? (int) $_SESSION['userid'] : 0;
$usertype = isset($_SESSION['usertype']) ? (int) $_SESSION['usertype'] : 0;
$name = isset($_SESSION['name']) ? $_SESSION['name'] : '';
$userstatus = isset($_SESSION['userstatus']) ? (int) $_SESSION['userstatus'] : 0;
if ($userstatus) {
header('Location: /');
exit;
}
//狀態為0時才顯示本頁
$savestatus = 0;
$errormsg = '';
$data['sales_channel'] = $sales_channel = isset($_POST['sales_channel']) ? $_POST['sales_channel'] : '';
$data['how_to_kown_we'] = $how_to_kown_we = isset($_POST['how_to_kown_we']) ? $_POST['how_to_kown_we'] : '';
$data['certification_photo'] = $certification_photo = isset($_POST['certification_photo_val']) ? $_POST['certification_photo_val'] : '';
$data['person_hold_photo'] = $person_hold_photo = isset($_POST['person_hold_photo_val']) ? $_POST['person_hold_photo_val'] : '';
$data['others_photo'] = $others_photo = isset($_POST['others_photo_val']) ? $_POST['others_photo_val'] : '';
if ($sales_channel && $how_to_kown_we && $certification_photo && $person_hold_photo) {
if (1 == $usertype) {
$data['enterprise_legal_photo'] = $enterprise_legal_photo = isset($_POST['enterprise_legal_photo_val']) ? $_POST['enterprise_legal_photo_val'] : '';
$data['enterprise_grant_photo'] = $enterprise_grant_photo = isset($_POST['enterprise_grant_photo_val']) ? $_POST['enterprise_grant_photo_val'] : '';
$data['enterprise_tax_photo'] = $enterprise_tax_photo = isset($_POST['enterprise_tax_photo_val']) ? $_POST['enterprise_tax_photo_val'] : '';
if (!$enterprise_legal_photo) {
$errormsg = '信息未填寫完整。';
$savestatus = -1;
} else {
Users::update($userid, $data);
$savestatus = 1;
}
} else {
Users::update($userid, $data);
$savestatus = 1;
}
}
if (!$savestatus) {
$userinfo = Users::getData($userid, 'certification_photo');
$savestatus = isset($userinfo['certification_photo']) ? $userinfo['certification_photo'] : '';
if ($savestatus) {
$savestatus = 1;
}
}
Templates::Assign('user', $user);
Templates::Assign('usertype', $usertype);
Templates::Assign('userid', $userid);
Templates::Assign('name', $name);
Templates::Assign('errormsg', $errormsg);
Templates::Assign('savestatus', $savestatus);
Templates::Display('signbccl.html');
}
示例5: isset
if (!$sku_id) {
ABase::toJson(1, 'error 001');
}
if (Favorite::add($userid, $sku_id)) {
ABase::toJson(0, 'ok');
}
ABase::toJson(1, 'error 009');
break;
case 'remove':
$id = isset($_POST['id']) ? (int) $_POST['id'] : 0;
if ($id) {
if (Favorite::del($id)) {
ABase::toJson(0, 'ok');
} else {
ABase::toJson(1, 'error 010');
}
}
ABase::toJson(1, 'error 011');
break;
default:
ABase::toJson(1, 'action error');
}
} else {
$page = isset($_GET['page']) ? (int) $_GET['page'] : 1;
$page_size = isset($_GET['page_size']) ? (int) $_GET['page_size'] : 16;
$favorites = Favorite::getLists($userid, $page, $page_size);
//var_dump($favorites);exit;
Templates::Assign('favorites', $favorites['data']);
Templates::Assign('paged', $favorites['page']);
Templates::Display('favorite.html');
}
示例6: header
if (!$item) {
header("Location: /html/404.html?005");
exit;
}
$sku['iteminfo'] = $item;
$sku_code = $sku['sku'];
$pics = ProductsPic::getSkuPics($sku_code, 'path', 'sort DESC LIMIT 0,3');
$sku['pics'] = $pics;
$sku['order_num'] = OrdersProducts::getSkuAllNum($sku_code);
$sku['stock'] = ProductsStock::getSkuStock($sku_code);
$skus = ProductsSku::getItemSkus($item_code, "id,sku,sku_name");
$skus = ProductsSku::getProductsPic($skus);
$sku['skus'] = $skus;
$userid = isset($_SESSION['userid']) ? (int) $_SESSION['userid'] : 0;
$history = array();
if ($userid) {
$history = UsersHistory::getProductViewLog($userid, $id);
}
if (!$history) {
$history = ProductsSku::getRand($item_code);
}
$history = ProductsSku::getProductsPic($history);
$history = ProductsSku::getProductsItemTitle($history);
ProductsSku::increase("id={$id}", 'view_num');
$log = array('op' => 'view', 'id' => $id, 'url' => Func::getCurrentURL());
$log = json_encode($log);
UsersHistory::addLog($userid, ProductsSku::$module_id, $log);
Templates::Assign('history', $history);
Templates::Assign('sku', $sku);
Templates::Display('product.html');
}
示例7: foreach
foreach ($ccids as $ccid) {
$tmp[] = $ccid['id'];
}
$ccid = implode(',', $tmp);
$produs = ProductsItem::getList("category_id IN ({$ccid}) AND status=1", '*', 'create_time DESC LIMIT 0,10');
}
$produs = getProducts($produs);
$products[$cid['id']]['prod'] = $produs;
$products[$cid['id']]['cate'] = array('id' => $cid['id'], 'name' => $cid['name']);
}
}
//var_dump($products);
Templates::Assign('is_paged', $is_paged);
Templates::Assign('cateid', $cateid);
Templates::Assign('products', $products);
Templates::Assign('paged', $paged);
Templates::Display('products.html');
function getProducts($products)
{
foreach ($products as $k => $product) {
$skus = ProductsSku::getItemSkus($product['item']);
$min = 100000.0;
$max = 0.0;
$price = '';
foreach ($skus as $sku) {
if ($min > $sku['current_price']) {
$min = $sku['current_price'];
}
if ($max < $sku['current_price']) {
$max = $sku['current_price'];
}
示例8: isset
<?php
Templates::Assign('picpath', _PRODUCTIMGPATH);
$root_cates = ProductsCategory::getRoot();
Templates::Assign('root_cates', $root_cates);
$cateid = isset($_GET['cateid']) ? $_GET['cateid'] : 0;
Templates::Assign('cateid', $cateid);
$userid = isset($_SESSION['userid']) ? (int) $_SESSION['userid'] : 0;
$userstatus = isset($_SESSION['userstatus']) ? (int) $_SESSION['userstatus'] : 0;
if (!$userstatus) {
$user = Users::check('', '', $userid);
$userstatus = isset($user['status']) ? (int) $user['status'] : 0;
$_SESSION['userstatus'] = $userstatus;
}
Templates::Assign('userstatus', $userstatus);
//獲取購物車
$cart_num = Cart::getNum($userid);
Templates::Assign('cart_num', $cart_num);
//------------- 微信 OPENID
$wxopenid = isset($_REQUEST['openid']) ? $_REQUEST['openid'] : (isset($_SESSION['wx']['openid']) ? $_SESSION['wx']['openid'] : '');
$wxnickname = isset($_REQUEST['nickname']) ? $_REQUEST['nickname'] : (isset($_SESSION['wx']['nickname']) ? $_SESSION['wx']['nickname'] : '');
$_SESSION['wx']['openid'] = $wxopenid;
$_SESSION['wx']['nickname'] = $wxnickname;
Templates::Assign('is_weixin', Func::isInWeixin());
示例9: foreach
$total = 0.0;
foreach ($product_ids as $sku_id => $product_id) {
$qt = isset($qts[$sku_id]) ? (int) $qts[$sku_id] : 0;
if ($qt < 1) {
continue;
}
$skus[$sku_id]['qt'] = $qt;
$skus[$sku_id]['info'] = $info = ProductsSku::getData($sku_id);
$current_price = isset($info['current_price']) ? $info['current_price'] : 0.0;
$pic = ProductsPic::getOne(array('sku' => $info['sku']), 'path', 'sort DESC');
$skus[$sku_id]['info']['pic'] = $pic['path'];
$item = ProductsSku::getSkuItem($info['item'], 'title');
$skus[$sku_id]['info']['title'] = $item['title'];
$total = $total + $qt * $current_price;
}
//var_dump($product_ids,$skus);exit;
$userlevel = Users::getLevel($userid);
$discount = $userlevel['discount'];
$newtotal = $total * $discount;
$address = ReceiverAddress::getInfoByUser($userid);
//var_dump($address);
$yunfei = 0.0;
$token = ABase::token();
Templates::Assign('yunfei', $yunfei);
Templates::Assign('token', $token);
Templates::Assign('address', $address);
Templates::Assign('userlevel', $userlevel);
Templates::Assign('newtotal', $newtotal);
Templates::Assign('total', $total);
Templates::Assign('skus', $skus);
Templates::Display('buy.html');
示例10: isset
<?php
//用戶信息
$userid = isset($_SESSION['userid']) ? (int) $_SESSION['userid'] : 0;
$user = Users::getData($userid);
$address = ReceiverAddress::getInfo($user['receiver_address_id']);
$provinces = Countys::getCountys();
$city = Countys::getName($address['receiver_city']);
$county = Countys::getName($address['receiver_county']);
//var_dump($address);
//var_dump($provinces);
Templates::Assign('provinces', $provinces);
Templates::Assign('city', $city);
Templates::Assign('county', $county);
Templates::Assign('address', $address);
Templates::Assign('user', $user);
Templates::Display('user.html');
示例11: isset
}
//----------------- user
$user = isset($_SESSION['user']) ? $_SESSION['user'] : null;
$name = isset($_SESSION['name']) ? $_SESSION['name'] : null;
$userid = isset($_SESSION['userid']) ? (int) $_SESSION['userid'] : 0;
$usertype = isset($_SESSION['usertype']) ? (int) $_SESSION['usertype'] : 0;
Templates::Assign('username', $user);
Templates::Assign('name', $name);
Templates::Assign('userid', $userid);
Templates::Assign('usertype', $usertype);
if (!$user && !in_array($action, $GLOBALS['EXCLUDE_URL'])) {
require_once 'sign.php';
exit;
}
include_once 'index_ext.php';
Templates::Assign('action', $action);
//------------------------ action
if ($action) {
$action = $action . ".php";
$flag = 0;
foreach (glob("*.php") as $webroot) {
if ($action === $webroot) {
require_once $action;
$flag = 1;
exit;
}
}
if (!$flag) {
header("Location: /html/404.html");
exit;
}
示例12: time
}
}
}
if (!$orders) {
Templates::Assign('errormsg', "未獲取到相應的訂單,或訂單已支付,或訂單已過期, 請核對後再試");
Templates::Display('error.html');
exit;
}
$redirect = 1;
}
$sign = _PTPPAYTOKEN . "-1001-" . $order_code . "-1001-" . time();
$sign = Func::encode($sign, _PTPPAYKEY);
if (!$sign) {
Templates::Assign('errormsg', "加密失敗,請到訂單列表頁麵繼續完成支付");
Templates::Display('error.html');
exit;
}
$host = $_SERVER['HTTP_HOST'];
$md = md5($sign . $host . $rate);
$payurl = _PTPPAYURL . "?sign={$sign}&host={$host}&rate={$rate}&md={$md}";
if ($redirect) {
header("Location: {$payurl}");
exit;
}
Templates::Assign('payurl', $payurl);
$rate = 1;
$md = md5($sign . $host . $rate);
$payurl_all = _PTPPAYURL . "?sign={$sign}&host={$host}&rate={$rate}&md={$md}";
Templates::Assign('payurl_all', $payurl_all);
Templates::Assign('order_code', $order_code);
Templates::Display('pay.html');
示例13: isset
$qt = isset($_POST['qt']) ? (int) $_POST['qt'] : 0;
$sku_id = isset($_POST['sku_id']) ? (int) $_POST['sku_id'] : 0;
if (!$qt || !$sku_id) {
ABase::toJson(1, 'error 001');
}
if (Cart::add($userid, $sku_id, $qt)) {
ABase::toJson(0, 'ok');
}
ABase::toJson(1, 'error 009');
break;
case 'remove':
$sku_id = isset($_POST['sku_id']) ? (int) $_POST['sku_id'] : 0;
if ($sku_id) {
if (Cart::del(0, array('user_id' => $userid, 'sku_id' => $sku_id))) {
ABase::toJson(0, 'ok');
} else {
ABase::toJson(1, 'error 010');
}
}
ABase::toJson(1, 'error 011');
break;
default:
ABase::toJson(1, 'action error');
}
} else {
$products = Cart::getProducts($userid);
$userlevel = Users::getLevel($userid);
Templates::Assign('userlevel', $userlevel);
Templates::Assign('products', $products);
Templates::Display('cart.html');
}
示例14: array
$YK_orders['yk_pay_method'] = PaymentMethod::getData($yk_paymethodid);
}
$BH_orders = array();
$BH_products = array();
$bh_order_code = str_replace('SK', 'BH', $order_code);
$BH_orders = Orders::getOne(array('order_code' => $bh_order_code));
if ($BH_orders) {
$BH_products = Orders::getOrderPrducts($bh_order_code);
}
$receiver_address_id = (int) $orders['receiver_address_id'];
$address = ReceiverAddress::getInfo($receiver_address_id);
$paymethodid = $orders['pay_method'];
$paymethod = PaymentMethod::getData($paymethodid);
$userlevel = Users::getLevel($userid);
$discount = $userlevel['discount'];
$products = Orders::getOrderPrducts($order_code);
//獲取order status 名稱
$statusname = OrdersStatus::getData($order_status);
$orders['order_statusname'] = $statusname['name'];
//var_dump($orders);
Templates::Assign('order_code', $order_code);
Templates::Assign('orders', $orders);
Templates::Assign('YK_orders', $YK_orders);
Templates::Assign('discount', $discount);
Templates::Assign('address', $address);
Templates::Assign('products', $products);
Templates::Assign('BH_orders', $BH_orders);
Templates::Assign('BH_products', $BH_products);
Templates::Assign('paymethod', $paymethod);
Templates::Display('order.html');
}