Esempio n. 1
0
 public function get($f3)
 {
     // 权限检查
     $this->requirePrivilege('manage_plugin_theme_adv_configure');
     global $smarty;
     $shop_index_advblock_json_data = json_decode(ShopThemePlugin::getOptionValue('shop_index_advblock_json_data'), true);
     if (!empty($shop_index_advblock_json_data)) {
         // 生成随机的 id 号给 html 使用
         foreach ($shop_index_advblock_json_data as &$advBlockObject) {
             $advBlockObject['id'] = Utils::generateRandomHtmlId();
             foreach ($advBlockObject['advBlockImageArray'] as &$advBlockImage) {
                 $advBlockImage['id'] = Utils::generateRandomHtmlId();
             }
         }
         $smarty->assign('shop_index_advblock_json_data', $shop_index_advblock_json_data);
     }
     $smarty->display('theme_shop_advshop_block.tpl', 'get');
 }
Esempio n. 2
0
 public function get($f3)
 {
     global $smarty;
     // 生成 smarty 的缓存 id
     $smartyCacheId = 'Shop|Index';
     // 开启并设置 smarty 缓存时间
     enableSmartyCache(true, bzf_get_option_value('smarty_cache_time_shop_index'));
     if ($smarty->isCached('shop_index.tpl', $smartyCacheId)) {
         goto out_display;
     }
     // 滑动图片广告
     $shop_index_adv_slider = json_decode(bzf_get_option_value('shop_index_adv_slider'), true);
     if (!empty($shop_index_adv_slider)) {
         $smarty->assign('shop_index_adv_slider', $shop_index_adv_slider);
     }
     // 今日新品
     $recommandGoodsArray = SearchHelper::search(SearchHelper::Module_Goods, $this->searchFieldSelector, $this->searchExtraCondArray, array(array('goods_id', 'desc')), 0, 40);
     if (!empty($recommandGoodsArray)) {
         $smarty->assign('recommandGoodsArray', $recommandGoodsArray);
     }
     // 广告 advBlock
     $shop_index_advblock_json_data = json_decode(bzf_get_option_value('shop_index_advblock_json_data'), true);
     if (!empty($shop_index_advblock_json_data)) {
         // 生成随机的 id 号给 html 使用
         foreach ($shop_index_advblock_json_data as &$advBlockObject) {
             $advBlockObject['id'] = Utils::generateRandomHtmlId();
             foreach ($advBlockObject['advBlockImageArray'] as &$advBlockImage) {
                 $advBlockImage['id'] = Utils::generateRandomHtmlId();
             }
         }
         $smarty->assign('shop_index_advblock_json_data', $shop_index_advblock_json_data);
     }
     // 移动端对应的 URL,用于百度页面适配
     $smarty->assign('currentPageMobileUrl', RouteHelper::makeShopSystemUrl(PluginHelper::SYSTEM_MOBILE, '/'));
     out_display:
     $smarty->assign('seo_title', $smarty->getTemplateVars('seo_title') . ',' . $f3->get('HOST'));
     $smarty->display('shop_index.tpl', $smartyCacheId);
 }