本文整理汇总了PHP中assign_template函数的典型用法代码示例。如果您正苦于以下问题:PHP assign_template函数的具体用法?PHP assign_template怎么用?PHP assign_template使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了assign_template函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show_api_message
function show_api_message($content, $links = '', $hrefs = '', $type = 'info', $auto_redirect = true)
{
assign_template();
$msg['content'] = $content;
if (is_array($links) && is_array($hrefs)) {
if (!empty($links) && count($links) == count($hrefs)) {
foreach ($links as $key => $val) {
$msg['url_info'][$val] = $hrefs[$key];
}
$msg['back_url'] = $hrefs['0'];
}
} else {
$link = empty($links) ? $GLOBALS['_LANG']['back_up_page'] : $links;
$href = empty($hrefs) ? 'javascript:history.back()' : $hrefs;
$msg['url_info'][$link] = $href;
$msg['back_url'] = $href;
}
$msg['type'] = $type;
$position = assign_ur_here(0, $GLOBALS['_LANG']['sys_msg']);
$GLOBALS['smarty']->assign('page_title', $position['title']);
// 页面标题
$GLOBALS['smarty']->assign('ur_here', $position['ur_here']);
// 当前位置
$GLOBALS['smarty']->assign('auto_redirect', $auto_redirect);
$GLOBALS['smarty']->assign('act', 'message');
$GLOBALS['smarty']->assign('message', $msg);
die($GLOBALS['smarty']->fetch($GLOBALS['api_tpl']));
}
示例2: __construct
public function __construct()
{
parent::__construct();
$this->action = ACTION_NAME;
/* 如果是显示页面,对页面进行相应赋值 */
assign_template();
$this->assign('action', $this->action);
}
示例3: __construct
/**
* 构造函数
*/
public function __construct() {
parent::__construct();
// 属性赋值
$this->user_id = $_SESSION['user_id'];
$this->action = ACTION_NAME;
// 验证登录
$this->check_login();
// 用户信息
$info = model('ClipsBase')->get_user_default($this->user_id);
// 如果是显示页面,对页面进行相应赋值
assign_template();
$this->assign('action', $this->action);
$this->assign('info', $info);
}
示例4: __construct
public function __construct()
{
parent::__construct();
$this->ecshop_init();
// 微信oauth处理
if (method_exists('WechatController', 'do_oauth')) {
call_user_func(array('WechatController', 'do_oauth'));
}
/* 语言包 */
$this->assign('lang', L());
/* 页面标题 */
$page_info = get_page_title();
self::$view->assign('page_title', $page_info['title']);
/* 模板赋值 */
assign_template();
}
示例5: __construct
/**
* 构造函数
*/
public function __construct()
{
parent::__construct();
// 属性赋值
$this->user_id = $_SESSION['user_id'];
$this->action = ACTION_NAME;
// 验证登录
$this->check_login();
// 用户信息
$info = model('ClipsBase')->get_user_default($this->user_id);
//判断用户类型,不是分销用户跳转到user控制器中
if ($info['user_rank'] != 255 && $this->user_id > 0) {
ecs_header("Location: " . url('user/index'));
}
// 如果是显示页面,对页面进行相应赋值
assign_template();
$this->assign('action', $this->action);
$this->assign('info', $info);
}
示例6: die
}
else
{}*/
if (!empty($_SERVER['QUERY_STRING'])) {
$back_act = 'user.php?' . $_SERVER['QUERY_STRING'];
}
$action = 'login';
} else {
//未登录提交数据。非正常途径提交数据!
die($_LANG['require_login']);
}
}
}
/* 如果是显示页面,对页面进行相应赋值 */
if (in_array($action, $ui_arr)) {
assign_template();
$position = assign_ur_here(0, $_LANG['user_center']);
$smarty->assign('page_title', $position['title']);
// 页面标题
$smarty->assign('ur_here', $position['ur_here']);
/* 是否显示积分兑换 */
if (!empty($_CFG['points_rule']) && unserialize($_CFG['points_rule'])) {
$smarty->assign('show_transform_points', 1);
}
$smarty->assign('helps', get_shop_help());
// 网店帮助
$smarty->assign('data_dir', DATA_DIR);
// 数据目录
$smarty->assign('action', $action);
$smarty->assign('lang', $_LANG);
}
示例7: info
public function info()
{
/* 取得参数:团购活动id */
$group_buy_id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;
if ($group_buy_id <= 0) {
ecs_header("Location: ./\n");
exit;
}
/* 取得团购活动信息 */
$group_buy = model('GroupBuyBase')->group_buy_info($group_buy_id);
if (empty($group_buy)) {
ecs_header("Location: ./\n");
exit;
}
$group_buy['gmt_end_date'] = $group_buy['end_date'];
$this->assign('group_buy', $group_buy);
/* 取得团购商品信息 */
$goods_id = $group_buy['goods_id'];
$goods = model('Goods')->goods_info($goods_id);
if (empty($goods)) {
ecs_header("Location: ./\n");
exit;
}
$goods['url'] = build_uri('goods', array('gid' => $goods_id), $goods['goods_name']);
$this->assign('gb_goods', $goods);
/* 取得商品的规格 */
$properties = model('Goods')->get_goods_properties($goods_id);
$this->assign('properties', $properties['pro']);
// 商品属性
$this->assign('specification', $properties['spe']);
// 商品规格
//模板赋值
$this->assign('cfg', C('CFG'));
assign_template();
//更新团购商品点击次数
$count = $this->model->table('touch_goods_activity')->field('COUNT(*)')->where('act_id =' . $group_buy_id)->getOne();
if ($count) {
$this->model->table('touch_goods_activity')->data('click_num = click_num + 1')->where('act_id = ' . $group_buy_id)->update();
} else {
$data['act_id'] = $group_buy_id;
$data['click_num'] = 1;
$this->model->table('touch_goods_activity')->data($data)->insert();
}
$this->assign('now_time', gmtime());
// 当前系统时间
$this->assign('goods_id', $group_buy_id);
// 商品的id
$this->display('group_buy_info.dwt');
}
示例8: get_twolevel_repay
$sql = 'SELECT cat_id FROM ' . $GLOBALS['ecs']->table('goods') . ' where goods_id =' . $goods['goods_id'];
$parentid = $GLOBALS['db']->getOne($sql);
$sql = 'SELECT parent_id from ' . $GLOBALS['ecs']->table('category') . ' where cat_id =' . $parentid;
$parentid = $GLOBALS['db']->getOne($sql);
$sql = 'SELECT cat_name FROM ' . $GLOBALS['ecs']->table('category') . ' where cat_id =' . $parentid;
$parentcatname = $GLOBALS['db']->getOne($sql);
if ($parentcatname == '季能赚') {
$levelinfo = get_twolevel_repay($parentid);
//查询分类下产品id
$smarty->assign('goodslevel', $levelinfo);
}
$catlist = array();
foreach (get_parent_cats($goods['cat_id']) as $k => $v) {
$catlist[] = $v['cat_id'];
}
assign_template('c', $catlist);
/* 上一个商品下一个商品 */
/*$prev_gid = $db->getOne("SELECT goods_id FROM " .$ecs->table('goods'). " WHERE cat_id=" . $goods['cat_id'] . " AND goods_id > " . $goods['goods_id'] . " AND is_on_sale = 1 AND is_alone_sale = 1 AND is_delete = 0 LIMIT 1");
if (!empty($prev_gid))
{
$prev_good['url'] = build_uri('goods', array('gid' => $prev_gid), $goods['goods_name']);
$smarty->assign('prev_good', $prev_good);//上一个商品
}
$next_gid = $db->getOne("SELECT max(goods_id) FROM " . $ecs->table('goods') . " WHERE cat_id=".$goods['cat_id']." AND goods_id < ".$goods['goods_id'] . " AND is_on_sale = 1 AND is_alone_sale = 1 AND is_delete = 0");
if (!empty($next_gid))
{
$next_good['url'] = build_uri('goods', array('gid' => $next_gid), $goods['goods_name']);
$smarty->assign('next_good', $next_good);//下一个商品
}*/
$position = assign_ur_here($goods['cat_id'], $goods['goods_name']);
示例9: intval
/* 获得指定的分类ID */
if (!empty($_GET['id'])) {
$cat_id = intval($_GET['id']);
} elseif (!empty($_GET['category'])) {
$cat_id = intval($_GET['category']);
}
/* 获得当前页码 */
$page = !empty($_REQUEST['page']) && intval($_REQUEST['page']) > 0 ? intval($_REQUEST['page']) : 1;
/*------------------------------------------------------ */
//-- PROCESSOR
/*------------------------------------------------------ */
/* 获得页面的缓存ID */
$cache_id = sprintf('%X', crc32($cat_id . '-' . $page . '-' . $_CFG['lang']));
if (!$smarty->is_cached('article_cat.dwt', $cache_id)) {
/* 如果页面没有被缓存则重新获得页面的内容 */
assign_template('a', array($cat_id));
$position = assign_ur_here($cat_id);
$smarty->assign('page_title', $position['title']);
// 页面标题
$smarty->assign('ur_here', $position['ur_here']);
// 当前位置
$smarty->assign('categories', get_categories_tree(0));
// 分类树
$smarty->assign('article_categories', article_categories_tree($cat_id));
//文章分类树
$smarty->assign('helps', get_shop_help());
// 网店帮助
$smarty->assign('top_goods', get_top10());
// 销售排行
$smarty->assign('best_goods', get_recommend_goods('best'));
$smarty->assign('new_goods', get_recommend_goods('new'));
示例10: show_message
/**
* 显示一个提示信息
*
* @access public
* @param string $content
* @param string $link
* @param string $href
* @param string $type 信息类型:warning, error, info
* @param string $auto_redirect 是否自动跳转
* @return void
*/
function show_message($content, $links = '', $hrefs = '', $type = 'info', $auto_redirect = true)
{
assign_template();
$msg['content'] = $content;
if (is_array($links) && is_array($hrefs)) {
if (!empty($links) && count($links) == count($hrefs)) {
foreach ($links as $key => $val) {
$msg['url_info'][$val] = $hrefs[$key];
}
$msg['back_url'] = $hrefs['0'];
}
} else {
$link = empty($links) ? L('back_up_page') : $links;
$href = empty($hrefs) ? 'javascript:history.back()' : $hrefs;
$msg['url_info'][$link] = $href;
$msg['back_url'] = $href;
}
$msg['type'] = $type;
if (is_null(ECTouch::view()->get_template_vars('helps'))) {
ECTouch::view()->assign('helps', model('Article')->get_shop_help());
// 网店帮助
}
ECTouch::view()->assign('title', L('tips_message'));
ECTouch::view()->assign('auto_redirect', $auto_redirect);
ECTouch::view()->assign('message', $msg);
ECTouch::view()->display('message.dwt');
exit;
}
示例11: show_message
/**
* 显示一个提示信息
*
* @access public
* @param string $content
* @param string $link
* @param string $href
* @param string $type 信息类型:warning, error, info
* @param string $auto_redirect 是否自动跳转
* @return void
*/
function show_message($content, $links = '', $hrefs = '', $type = 'info', $auto_redirect = true)
{
assign_template();
$msg['content'] = $content;
if (is_array($links) && is_array($hrefs)) {
if (!empty($links) && count($links) == count($hrefs)) {
foreach ($links as $key => $val) {
$msg['url_info'][$val] = $hrefs[$key];
}
$msg['back_url'] = $hrefs['0'];
}
} else {
$link = empty($links) ? $GLOBALS['_LANG']['back_up_page'] : $links;
$href = empty($hrefs) ? 'javascript:history.back()' : $hrefs;
$msg['url_info'][$link] = $href;
$msg['back_url'] = $href;
}
$msg['type'] = $type;
$position = assign_ur_here(0, $GLOBALS['_LANG']['sys_msg']);
$GLOBALS['smarty']->assign('page_title', $position['title']);
// 页面标题
$GLOBALS['smarty']->assign('ur_here', $position['ur_here']);
// 当前位置
if (is_null($GLOBALS['smarty']->get_template_vars('helps'))) {
$GLOBALS['smarty']->assign('helps', get_shop_help());
// 网店帮助
}
$GLOBALS['smarty']->assign('auto_redirect', $auto_redirect);
$GLOBALS['smarty']->assign('message', $msg);
$GLOBALS['smarty']->display('message.dwt');
exit;
}
示例12: show
/**
* 显示错误信息
*
* @access public
* @param string $link
* @param string $href
* @return void
*/
function show($link = '', $href = '')
{
if ($this->error_no > 0) {
$message = array();
$message['link'] = empty($link) ? $GLOBALS['_LANG']['back_up_page'] : $link;
$message['href'] = empty($href) ? 'javascript:history.back();' : $href;
foreach ($this->_message as $msg) {
$message['content'] = '<div>' . htmlspecialchars($msg) . '</div>';
}
if (isset($GLOBALS['smarty'])) {
assign_template();
$GLOBALS['smarty']->assign('message', $message);
$GLOBALS['smarty']->display($this->_template);
} else {
die($message['content']);
}
exit;
}
}
示例13: define
<?php
/********************************************
快讯打印页面
time:2014-07-07
********************************************/
define('IN_ECS', true);
require dirname(__FILE__) . '/includes/init.php';
$class_print = new class_print();
$smarty->assign('helps', get_shop_help());
// 网店帮助
$smarty->assign('print', 'print');
assign_template('', '');
//页面底部信息
if ($_REQUEST['act'] == 'index') {
print_user();
$smarty->assign('act', 'index');
$smarty->assign('user_id', $_SESSION['user_id']);
} elseif ($_REQUEST['act'] == 'var_normal') {
print_user();
$smarty->assign('act', 'var_normal');
} elseif ($_REQUEST['act'] == 'var_simple') {
print_user();
$smarty->assign('act', 'var_simple');
} elseif ($_REQUEST['act'] == 'old') {
print_user();
if (isset($_REQUEST['del']) && $_REQUEST['del'] == '1') {
unset($_SESSION[$_REQUEST['p']]);
}
示例14: show
/**
* 显示错误信息
*
* @access public
* @param string $link
* @param string $href
* @return void
*/
function show($link = '', $href = '')
{
if ($this->error_no > 0) {
$message = array();
$link = empty($link) ? L('back_up_page') : $link;
$href = empty($href) ? 'javascript:history.back();' : $href;
$message['url_info'][$link] = $href;
$message['back_url'] = $href;
foreach ($this->_message as $msg) {
$message['content'] = htmlspecialchars($msg);
}
$view = ECTouch::view();
if (isset($view)) {
assign_template();
ECTouch::view()->assign('title', L('tips_message'));
ECTouch::view()->assign('auto_redirect', true);
ECTouch::view()->assign('message', $message);
ECTouch::view()->display($this->_template);
} else {
die($message['content']);
}
exit;
}
}
示例15: action_view
//.........这里部分代码省略.........
// $goods['child_cat'] = get_child_cat($parent_cat_id); // 相关分类
// $goods['get_cat_brands'] = get_cat_brands($parent_cat_id);; // 同类品牌
$smarty->assign('url', $_SERVER["REQUEST_URI"]);
$smarty->assign('volume_price', $goods_volume_price);
$smarty->assign('goods_id', $goods['goods_id']);
$smarty->assign('promote_end_time', $goods['gmt_end_time']);
$smarty->assign('helps', get_shop_help());
// 网店帮助
$smarty->assign('top_goods', get_top10());
// 销售排行
$smarty->assign('promotion_info', get_promotion_info());
// yyy添加start
$count1 = $GLOBALS['db']->getOne("SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('comment') . " where comment_type=0 and id_value ='{$goods_id}' and status=1");
$smarty->assign('review_count', $count1);
// 评论数
// 评价晒单 增加 by www.68ecshop.com
$rank_num['rank_a'] = $GLOBALS['db']->getOne("SELECT COUNT(*) AS num FROM " . $GLOBALS['ecs']->table('comment') . " WHERE id_value = '{$goods_id}' AND status = 1 AND comment_rank in (5,4)");
$rank_num['rank_b'] = $GLOBALS['db']->getOne("SELECT COUNT(*) AS num FROM " . $GLOBALS['ecs']->table('comment') . " WHERE id_value = '{$goods_id}' AND status = 1 AND comment_rank in (3,2)");
$rank_num['rank_c'] = $GLOBALS['db']->getOne("SELECT COUNT(*) AS num FROM " . $GLOBALS['ecs']->table('comment') . " WHERE id_value = '{$goods_id}' AND status = 1 AND comment_rank = 1");
$rank_num['rank_total'] = $rank_num['rank_a'] + $rank_num['rank_b'] + $rank_num['rank_c'];
$rank_num['rank_pa'] = $rank_num['rank_a'] > 0 ? round($rank_num['rank_a'] / $rank_num['rank_total'] * 100, 1) : 0;
$rank_num['rank_pb'] = $rank_num['rank_b'] > 0 ? round($rank_num['rank_b'] / $rank_num['rank_total'] * 100, 1) : 0;
$rank_num['rank_pc'] = $rank_num['rank_c'] > 0 ? round($rank_num['rank_c'] / $rank_num['rank_total'] * 100, 1) : 0;
$rank_num['shaidan_num'] = $GLOBALS['db']->getOne("SELECT COUNT(*) AS num FROM " . $GLOBALS['ecs']->table('shaidan') . " WHERE goods_id = '{$goods_id}' AND status = 1");
$smarty->assign('rank_num', $rank_num);
$res = $GLOBALS['db']->getAll("SELECT * FROM " . $GLOBALS['ecs']->table('goods_tag') . " WHERE goods_id = '{$goods_id}' AND state = 1");
foreach ($res as $v) {
$v['tag_num'] = $GLOBALS['db']->getOne("SELECT COUNT(*) AS num FROM " . $GLOBALS['ecs']->table('comment') . " WHERE id_value = '{$goods_id}' AND status = 1 AND FIND_IN_SET({$v['tag_id']},comment_tag)");
$tag_arr[] = $v;
}
require_once 'includes/lib_comment.php';
$tag_arr = array_sort($tag_arr, 'tag_num', 'desc');
if ($tag_arr) {
foreach ($tag_arr as $key => $val) {
if ($_CFG['tag_show_num'] > 0) {
if ($key + 1 <= $_CFG['tag_show_num']) {
$comment_tags[] = $val;
}
} else {
$comment_tags[] = $val;
}
}
}
$smarty->assign('comment_tags', $comment_tags);
/* meta */
$smarty->assign('keywords', htmlspecialchars($goods['keywords']));
$smarty->assign('description', htmlspecialchars($goods['goods_brief']));
$goods['goods_style_name'] = add_style($goods['goods_name'], $goods['goods_name_style']);
$smarty->assign('goods', $goods);
$smarty->assign('goods_id', $goods['goods_id']);
/* 取得商品的规格 */
$properties = get_goods_properties($goods_id);
$smarty->assign('specification', $properties['spe']);
// 商品规格
$smarty->assign('pictures', get_goods_gallery_attr_2($goods_id, $goods_attr_id));
// 商品相册
$smarty->assign('new_goods', get_recommend_goods('new'));
// 最新商品
$smarty->assign('shop_country', $_CFG['shop_country']);
/* 代码增加_start By www.ecshop68.com */
$sql_attr = "SELECT a.attr_id, ga.goods_attr_id FROM " . $GLOBALS['ecs']->table('attribute') . " AS a left join " . $GLOBALS['ecs']->table('goods_attr') . " AS ga on a.attr_id=ga.attr_id WHERE a.is_attr_gallery=1 and ga.goods_id='" . $goods_id . "' order by ga.goods_attr_id ";
$goods_attr = $GLOBALS['db']->getRow($sql_attr);
if ($goods_attr) {
$goods_attr_id = $goods_attr['goods_attr_id'];
$smarty->assign('attr_id', $goods_attr['attr_id']);
} else {
$smarty->assign('attr_id', 0);
}
$prod_exist_arr = array();
$sql_prod = "select goods_attr from " . $GLOBALS['ecs']->table('products') . " where product_number>0 and goods_id='{$goods_id}' order by goods_attr";
$res_prod = $GLOBALS['db']->query($sql_prod);
while ($row_prod = $GLOBALS['db']->fetchRow($res_prod)) {
$prod_exist_arr[] = "|" . $row_prod['goods_attr'] . "|";
}
$smarty->assign('prod_exist_arr', $prod_exist_arr);
// 模板赋值
$smarty->assign('cfg', $_CFG);
assign_template();
$position = assign_ur_here(0, $goods['goods_name']);
$smarty->assign('page_title', $position['title']);
// 页面标题
$smarty->assign('ur_here', $position['ur_here']);
// 当前位置
/* 代码增加_start By www.68ecshop.com */
$goods['supplier_name'] = "网站自营";
if ($goods['supplier_id'] > 0) {
$sql_supplier = "SELECT s.supplier_id,s.supplier_name,s.add_time,sr.rank_name FROM " . $ecs->table("supplier") . " as s left join " . $ecs->table("supplier_rank") . " as sr ON s.rank_id=sr.rank_id WHERE s.supplier_id=" . $goods[supplier_id] . " AND s.status=1";
$shopuserinfo = $db->getRow($sql_supplier);
$goods['supplier_name'] = $shopuserinfo['supplier_name'];
get_dianpu_baseinfo($goods['supplier_id'], $shopuserinfo);
}
assign_dynamic('pre_sale_goods');
}
// 更新商品点击次数
$sql = 'UPDATE ' . $GLOBALS['ecs']->table('goods') . ' SET click_count = click_count + 1 ' . "WHERE goods_id = '" . $pre_sale['goods_id'] . "'";
$GLOBALS['db']->query($sql);
$smarty->assign('now_time', gmtime());
// 当前系统时间
$smarty->display('pre_sale_goods.dwt', $cache_id);
}