本文整理汇总了PHP中Tpl类的典型用法代码示例。如果您正苦于以下问题:PHP Tpl类的具体用法?PHP Tpl怎么用?PHP Tpl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Tpl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pic_cutOp
/**
* 图片裁剪
*
*/
public function pic_cutOp()
{
Uk86Language::uk86_read('admin_common');
$lang = Uk86Language::uk86_getLangContent();
uk86_import('function.thumb');
if (uk86_chksubmit()) {
$thumb_width = $_POST['x'];
$x1 = $_POST["x1"];
$y1 = $_POST["y1"];
$x2 = $_POST["x2"];
$y2 = $_POST["y2"];
$w = $_POST["w"];
$h = $_POST["h"];
$scale = $thumb_width / $w;
$src = str_ireplace(UPLOAD_SITE_URL, BASE_UPLOAD_PATH, $_POST['url']);
if (strpos($src, '..') !== false || strpos($src, BASE_UPLOAD_PATH) !== 0) {
exit;
}
if (!empty($_POST['filename'])) {
// $save_file2 = BASE_UPLOAD_PATH.'/'.$_POST['filename'];
$save_file2 = str_ireplace(UPLOAD_SITE_URL, BASE_UPLOAD_PATH, $_POST['filename']);
} else {
$save_file2 = str_replace('_small.', '_sm.', $src);
}
$cropped = uk86_resize_thumb($save_file2, $src, $w, $h, $x1, $y1, $scale);
@unlink($src);
$pathinfo = pathinfo($save_file2);
exit($pathinfo['basename']);
}
$save_file = str_ireplace(UPLOAD_SITE_URL, BASE_UPLOAD_PATH, $_GET['url']);
$_GET['resize'] = $_GET['resize'] == '0' ? '0' : '1';
Tpl::output('height', uk86_get_height($save_file));
Tpl::output('width', uk86_get_width($save_file));
Tpl::showpage('common.pic_cut', 'null_layout');
}
示例2: newTemplateFromFile
public static function newTemplateFromFile($path)
{
$tpl = new Tpl($path);
$tpl->setDirectories(static::$_directories);
$tpl->setVarFunctions(static::$_functions);
$tpl->setIgnoreNotFoundBlocs(static::$_ignoreNotFoundBlocs);
return $tpl;
}
示例3: generate_graminfo_files
function generate_graminfo_files($outDir)
{
$tpl = new Tpl(dirname(__FILE__) . '/tpl');
$storage_ary = array('File', 'Mem', 'Shm');
$tpl = new Tpl(dirname(__FILE__) . '/tpl');
$helper_class = "Helper";
foreach ($storage_ary as $storage_name) {
$storage_class = "StorageHelper_" . ucfirst($storage_name);
$helper = new $helper_class($tpl, new $storage_class());
$result = $tpl->get('graminfo', array('helper' => $helper));
$file_name = "{$outDir}/graminfo_" . strtolower($storage_name) . '.php';
file_put_contents($file_name, $result);
unset($helper);
}
}
示例4: pic_cutOp
/**
* 图片裁剪
*
*/
public function pic_cutOp()
{
import('function.thumb');
if (chksubmit()) {
$thumb_width = $_POST['x'];
$x1 = $_POST["x1"];
$y1 = $_POST["y1"];
$x2 = $_POST["x2"];
$y2 = $_POST["y2"];
$w = $_POST["w"];
$h = $_POST["h"];
$scale = $thumb_width / $w;
$src = str_ireplace(UPLOAD_SITE_URL, BASE_UPLOAD_PATH, $_POST['url']);
if (strpos($src, '..') !== false || strpos($src, BASE_UPLOAD_PATH) !== 0) {
exit;
}
$save_file2 = str_replace('_small.', '_sm.', $src);
$cropped = resize_thumb($save_file2, $src, $w, $h, $x1, $y1, $scale);
@unlink($src);
$pathinfo = pathinfo($save_file2);
exit($pathinfo['basename']);
} else {
Language::read('cut');
$lang = Language::getLangContent();
}
$save_file = str_ireplace(UPLOAD_SITE_URL, BASE_UPLOAD_PATH, $_GET['url']);
$_GET['x'] = intval($_GET['x']) > 50 && $_GET['x'] < 400 ? $_GET['x'] : 200;
$_GET['y'] = intval($_GET['y']) > 50 && $_GET['y'] < 400 ? $_GET['y'] : 200;
$_GET['resize'] = $_GET['resize'] == '0' ? '0' : '1';
Tpl::output('height', get_height($save_file));
Tpl::output('width', get_width($save_file));
Tpl::showpage('cut', 'null_layout');
}
示例5: indexOp
/**
* 分类列表
*/
public function indexOp()
{
Language::read('home_category_index');
$lang = Language::getLangContent();
//得到分类类型
$type = trim($_GET['type']);
switch ($type) {
case 'store':
$model_sc = Model('store_class');
$sc_list = $model_sc->getTreeList();
//导航
$nav_link = array('0' => array('title' => $lang['homepage'], 'link' => SiteUrl . '/index.php'), '1' => array('title' => $lang['category_index_store_class']));
$model_store = Model('store');
//推荐店铺
$recommend_store = $model_store->getRecommendStore(5);
Tpl::output('recommend_store', $recommend_store);
//最新店铺
$new_store = $model_store->getNewStore(5);
Tpl::output('new_store', $new_store);
Tpl::output('nav_link_list', $nav_link);
Tpl::output('sc_list', $sc_list);
Tpl::showpage('category_store');
break;
default:
//导航
$nav_link = array('0' => array('title' => $lang['homepage'], 'link' => SiteUrl . '/index.php'), '1' => array('title' => $lang['category_index_goods_class']));
//分类
$show_goods_class = ($g = F('goods_class')) ? $g : H('goods_class', true, 'file');
Tpl::output('nav_link_list', $nav_link);
Tpl::output('gc_list', $show_goods_class);
Tpl::output('html_title', C('site_name') . ' - ' . Language::get('category_index_goods_class'));
Tpl::showpage('category_goods');
break;
}
}
示例6: profile_menu
/**
* 用户中心右边,小导航
*
* @param string $menu_type 导航类型
* @param string $menu_key 当前导航的menu_key
* @return
*/
private function profile_menu($menu_key = '')
{
Language::read('member_layout');
$menu_array = array(1 => array('menu_key' => 'store_printsetup', 'menu_name' => '打印设置', 'menu_url' => 'index.php?act=store_printsetup&op=index'));
Tpl::output('member_menu', $menu_array);
Tpl::output('menu_key', $menu_key);
}
示例7: profile_menu
/**
* 用户中心右边,小导航
*
* @param string $menu_key 当前导航的menu_key
* @return
*/
private function profile_menu($menu_key = '')
{
$menu_array = array();
$menu_array[] = array('menu_key' => 'log_list', 'menu_name' => '日志列表', 'menu_url' => urlShop('seller_log', 'log_list'));
Tpl::output('member_menu', $menu_array);
Tpl::output('menu_key', $menu_key);
}
示例8: indexOp
public function indexOp()
{
Language::read('home_index_index');
Tpl::output('index_sign', 'index');
$model_setting = Model('setting');
$setting = $model_setting->getListSetting();
//抢购专区
if (intval($setting['groupbuy_allow']) == 1) {
Language::read('member_groupbuy');
$model_groupbuy = Model('groupbuy');
$group_list = $model_groupbuy->getGroupbuyCommendedList(1);
Tpl::output('group_list', $group_list);
}
//限时折扣
if (intval($setting['promotion_allow']) == 1) {
$model_xianshi_goods = Model('p_xianshi_goods');
$xianshi_item = $model_xianshi_goods->getXianshiGoodsCommendList(2);
Tpl::output('xianshi_item', $xianshi_item);
}
//板块信息
//$model_web_config = Model('web_config');
$model_web_config = Model('web_config');
// dev_end
$web_html = $model_web_config->getWebHtml('index');
Tpl::output('web_html', $web_html);
// Dev: 品牌信息
$model_brand = Model('brand');
$condition = 'brand_apply=1 and brand_pic IS NOT NULL AND TRIM(brand_pic) <> \'\'';
$brand_list = $model_brand->where($condition)->limit(6)->select();
Tpl::output('brand_list', $brand_list);
// Dev_end
Model('seo')->type('index')->show();
Tpl::showpage('index');
}
示例9: mb_appOp
/**
* 设置下载地址
*
*/
public function mb_appOp()
{
$model_setting = Model('setting');
$mobile_apk = $model_setting->getRowSetting('mobile_apk');
$mobile_content = $model_setting->getRowSetting('mobile_content');
$mobile_apk_version = $model_setting->getRowSetting('mobile_apk_version');
$mobile_ios = $model_setting->getRowSetting('mobile_ios');
if (chksubmit()) {
$update_array = array();
$update_array['mobile_apk'] = $_POST['mobile_apk'];
$update_array['mobile_apk_version'] = intval($_POST['mobile_apk_version']);
$update_array['mobile_content'] = $_POST['mobile_content'];
$update_array['mobile_ios'] = $_POST['mobile_ios'];
$state = $model_setting->updateSetting($update_array);
if ($state) {
$this->log('设置手机端下载地址');
showMessage(Language::get('nc_common_save_succ'), 'index.php?act=mb_app&op=mb_app');
} else {
showMessage(Language::get('nc_common_save_fail'));
}
}
Tpl::output('mobile_apk', $mobile_apk);
Tpl::output('mobile_version', $mobile_apk_version);
Tpl::output('mobile_ios', $mobile_ios);
Tpl::output('mobile_content', $mobile_content);
Tpl::showpage('mb_app.edit');
}
示例10: editOp
/**
* 编辑
*/
public function editOp()
{
$model_payment = Model('payment');
if (chksubmit()) {
$payment_id = intval($_POST["payment_id"]);
$data = array();
$data['payment_state'] = intval($_POST["payment_state"]);
$payment_config = '';
$config_array = explode(',', $_POST["config_name"]);
//配置参数
if (is_array($config_array) && !empty($config_array)) {
$config_info = array();
foreach ($config_array as $k) {
$config_info[$k] = trim($_POST[$k]);
}
$payment_config = serialize($config_info);
}
$data['payment_config'] = $payment_config;
//支付接口配置信息
$model_payment->editPayment($data, array('payment_id' => $payment_id));
showMessage(Language::get('nc_common_save_succ'), 'index.php?act=payment&op=index');
}
$payment_id = intval($_GET["payment_id"]);
$payment = $model_payment->getPaymentInfo(array('payment_id' => $payment_id));
if ($payment['payment_config'] != '') {
Tpl::output('config_array', unserialize($payment['payment_config']));
}
Tpl::output('payment', $payment);
Tpl::showpage('payment.edit');
}
示例11: indexOp
/**
* 店铺开店页
*
*/
public function indexOp()
{
Language::read("home_login_index");
$code_info = C('store_joinin_pic');
$info['pic'] = array();
if (!empty($code_info)) {
$info = unserialize($code_info);
}
Tpl::output('pic_list', $info['pic']);
//首页图片
Tpl::output('show_txt', $info['show_txt']);
//贴心提示
$model_help = Model('help');
$condition['type_id'] = '1';
//入驻指南
$help_list = $model_help->getHelpList($condition, '', 4);
//显示4个
Tpl::output('help_list', $help_list);
Tpl::output('article_list', '');
//底部不显示文章分类
Tpl::output('show_sign', 'joinin');
Tpl::output('html_title', C('site_name') . ' - ' . '商家入驻');
Tpl::setLayout('store_joinin_layout');
Tpl::showpage('store_joinin');
}
示例12: returnOp
/**
* 支付回调
*/
public function returnOp()
{
$verify_result = $this->_verify_result('return');
if ($verify_result) {
//商户订单号
$out_trade_no = $_GET['out_trade_no'];
//支付宝交易号
$trade_no = $_GET['trade_no'];
//支付接口代码
$payment_code = 'alipay';
//验证成功
$model_order = Model('order');
$model_payment = Model('payment');
$order_list = $model_order->getOrderList(array('pay_sn' => $out_trade_no, 'order_state' => ORDER_STATE_NEW));
$result = $model_payment->updateProductBuy($out_trade_no, $payment_code, $order_list, $trade_no);
if (empty($result['error'])) {
Tpl::output('result', 'success');
Tpl::output('message', '支付成功');
} else {
Tpl::output('result', 'fail');
Tpl::output('message', '支付失败');
}
} else {
//验证失败
//如要调试,请看alipay_notify.php页面的verifyReturn函数
Tpl::output('result', 'fail');
Tpl::output('message', '支付失败');
}
Tpl::showpage('payment_message');
}
示例13: pointvoucherOp
/**
* 所有卡卷包
*/
public function pointvoucherOp()
{
$model = Model('voucher_template');
//查询条件
$condition = array();
$condition['voucher_t_start_date'] = array('lt', time());
$condition['voucher_t_end_date'] = array('gt', time());
$condition['voucher_t_state'] = 1;
$condition['voucher_t_total'] = array('gt', 'voucher_t_giveout');
//排序
if ($_GET['order_type'] == 1 || empty($_GET['order_type'])) {
$order = 'voucher_t_recommend desc, voucher_t_start_date desc';
} elseif ($_GET['order_type'] == 2) {
$order = 'voucher_t_giveout desc';
} else {
if ($_GET['order'] == 'asc') {
$order = 'voucher_t_points asc';
} else {
$order = 'voucher_t_points desc';
}
}
$field = 'voucher_t_id, voucher_t_end_date, voucher_t_price, voucher_t_points, voucher_t_limit, voucher_t_title, voucher_t_customimg';
$voucher_list = $model->where($condition)->field($field)->order($order)->select();
Tpl::output('list', $voucher_list);
Tpl::showpage('ucoin.index');
}
示例14: indexOp
public function indexOp()
{
$model_store = Model('store');
$model_store_bind_class = Model('store_bind_class');
$model_store_class = Model('store_class');
$model_store_grade = Model('store_grade');
// 店铺信息
$store_info = $model_store->getStoreInfoByID($_SESSION['store_id']);
Tpl::output('store_info', $store_info);
// 店铺分类信息
$store_class_info = $model_store_class->getOneClass($store_info['sc_id']);
Tpl::output('store_class_name', $store_class_info['sc_name']);
// 店铺等级信息
$store_grade_info = $model_store_grade->getOneGrade($store_info['grade_id']);
Tpl::output('store_grade_name', $store_grade_info['sg_name']);
$model_store_joinin = Model('store_joinin');
$joinin_detail = $model_store_joinin->getOne(array('member_id' => $store_info['member_id']));
Tpl::output('joinin_detail', $joinin_detail);
$store_bind_class_list = $model_store_bind_class->getStoreBindClassList(array('store_id' => $_SESSION['store_id']), null);
$goods_class = H('goods_class') ? H('goods_class') : H('goods_class', true);
for ($i = 0, $j = count($store_bind_class_list); $i < $j; $i++) {
$store_bind_class_list[$i]['class_1_name'] = $goods_class[$store_bind_class_list[$i]['class_1']]['gc_name'];
$store_bind_class_list[$i]['class_2_name'] = $goods_class[$store_bind_class_list[$i]['class_2']]['gc_name'];
$store_bind_class_list[$i]['class_3_name'] = $goods_class[$store_bind_class_list[$i]['class_3']]['gc_name'];
}
Tpl::output('store_bind_class_list', $store_bind_class_list);
Tpl::showpage('store_info');
}
示例15: resources_manageOp
/**
* cms设置
*/
public function resources_manageOp()
{
$model_setting = Model('setting');
$setting_list = $model_setting->getListSetting();
Tpl::output('setting', $setting_list);
Tpl::showpage('resources_manage');
}