diff --git a/application/controllers/information.php b/application/controllers/information.php index 8935b4fa..98e33dab 100644 --- a/application/controllers/information.php +++ b/application/controllers/information.php @@ -503,7 +503,7 @@ class Information extends CI_Controller if ($this->config->item('site_code') == 'ch') { $this->make_www_cache('pc', $information); $this->make_www_cache('mobile', $information); - }else if ($this->config->item('site_code') == 'ah') { + } else if ($this->config->item('site_code') == 'ah') { $this->make_www_cache_ah('pc', $information); $this->make_www_cache_ah('mobile', $information); } else if ($this->config->item('site_code') == 'chinatravel') { @@ -586,17 +586,17 @@ class Information extends CI_Controller break; default: } - + $breadcrumb_data = $this->Information_model->get_path_exclude_self($information->is_id, $information->is_path); $breadcrumb_structured_data_content = $this->load->view( - $template_path . '-structured-data-breadcrumb', - array('breadcrumb_data' => $breadcrumb_data, 'information' => $information), + $template_path . '-structured-data-breadcrumb', + array('breadcrumb_data' => $breadcrumb_data, 'information' => $information), true); - $template = str_replace( - '', - $breadcrumb_structured_data_content, - $template); + $template = str_replace( + '', + $breadcrumb_structured_data_content, + $template); //替换模板中的标签 @@ -606,14 +606,14 @@ class Information extends CI_Controller $template = str_replace('', $this->config->item('site_url') . $information->ic_url, $template); //火车票搜索框添加 - if ($information->is_parent_id == "278008234"){ + if ($information->is_parent_id == "278008234") { //本地测试的火车父类ID为:278035939 。网前为:278008234 - $template_TrainSearch = $this->load->view($template_path . '-train-detail',null, TRUE); + $template_TrainSearch = $this->load->view($template_path . '-train-detail', null, TRUE); $template = str_replace('', $template_TrainSearch, $template); } //非产品页面 - $meta_product_code=get_meta($information->ic_id, 'meta_product_code'); + $meta_product_code = get_meta($information->ic_id, 'meta_product_code'); if (empty($meta_product_code)) { //H1模板替换 $data_H1 = array(); @@ -625,19 +625,30 @@ class Information extends CI_Controller $template_H1 = $this->load->view($template_path . '-h1', $data_H1, TRUE); $template = str_replace('', $template_H1, $template); - //信息推荐 - $template_NEXT = $this->call_mobile_template_NEXT($template_path, $information->is_id); - $template = str_replace('', $template_NEXT, $template); $addthis_widget = $this->load->view($template_path . '-add-this', false, true); $template = str_replace('', $addthis_widget, $template); } else { $template = str_replace('', '', $template); - $inquiry_form_template = $this->load->view($template_path . '-inquiry-form', array('meta_product_code'=>$meta_product_code), true); + $inquiry_form_template = $this->load->view($template_path . '-inquiry-form', array('meta_product_code' => $meta_product_code), true); $information->ic_content = str_replace('', $inquiry_form_template, $information->ic_content); - $breadcrumb_content = $this->load->view($template_path . '-breadcrumb', array('breadcrumb_data'=>$breadcrumb_data), true); + $breadcrumb_content = $this->load->view($template_path . '-breadcrumb', array('breadcrumb_data' => $breadcrumb_data), true); $information->ic_content = str_replace('', $breadcrumb_content, $information->ic_content); } + + //信息推荐 + $template_recommand = $this->recommand_information($information); + $template = str_replace('', $this->load->view($template_path . '-next', array('recommands' => $template_recommand), TRUE), $template); +// //广告,改叫tips,防止被插件屏蔽 + if (!empty($template_recommand['Tips Right'])) { + $template = str_replace('', "
" . $template_recommand['Tips Right']->it_content . "
", $template); + } +// //文中的信息推荐 +// if(strpos($information->ic_content,'')!==false){ +// $information->ic_content = str_replace('', $this->load->view($template_path . '-recommends-article', array('recommands'=>$template_recommand), TRUE), $information->ic_content); +// } + + //顶部全屏大图 if ($device == 'mobile') { //移动端读取移动大图 $meta_addon_picture = get_meta($information->ic_id, 'meta_addon_picture_mobile'); @@ -675,7 +686,7 @@ class Information extends CI_Controller $template = str_replace('', '', $template); } //设置内容图片缓加载 - $lazy_content=$this->html_optimize_lib->set_lazy_loader($information->ic_content,'https://data.chinahighlights.com/grey.gif'); + $lazy_content = $this->html_optimize_lib->set_lazy_loader($information->ic_content, 'https://data.chinahighlights.com/grey.gif'); $template = str_replace('', $lazy_content, $template); //替换内容中各种标签 @@ -765,18 +776,18 @@ class Information extends CI_Controller //推荐信息或者产品 //信息推荐 $template_recommand = $this->recommand_information($information); - $template = str_replace('', $this->load->view($template_path . '-next', array('recommands'=>$template_recommand), TRUE), $template); + $template = str_replace('', $this->load->view($template_path . '-next', array('recommands' => $template_recommand), TRUE), $template); //广告,改叫tips,防止被插件屏蔽 - if(!empty($template_recommand['Tips Right'])) { - $template = str_replace('', "
".$template_recommand['Tips Right']->it_content."
", $template); + if (!empty($template_recommand['Tips Right'])) { + $template = str_replace('', "
" . $template_recommand['Tips Right']->it_content . "
", $template); } //文中的信息推荐 - if(strpos($information->ic_content,'')!==false){ - $information->ic_content = str_replace('', $this->load->view($template_path . '-recommends-article', array('recommands'=>$template_recommand), TRUE), $information->ic_content); + if (strpos($information->ic_content, '') !== false) { + $information->ic_content = str_replace('', $this->load->view($template_path . '-recommends-article', array('recommands' => $template_recommand), TRUE), $information->ic_content); } //文中的线路推荐 - if(strpos($information->ic_content,'')!==false){ - $information->ic_content = str_replace('', $this->load->view($template_path . '-recommends-tour', array('recommands'=>$template_recommand), TRUE), $information->ic_content); + if (strpos($information->ic_content, '') !== false) { + $information->ic_content = str_replace('', $this->load->view($template_path . '-recommends-tour', array('recommands' => $template_recommand), TRUE), $information->ic_content); } //非产品页面 @@ -803,18 +814,18 @@ class Information extends CI_Controller $template = str_replace('', '', $template); } //设置内容图片缓加载 - $lazy_content=$this->html_optimize_lib->set_lazy_loader($information->ic_content,'https://data.asiahighlights.com/grey.gif'); + $lazy_content = $this->html_optimize_lib->set_lazy_loader($information->ic_content, 'https://data.asiahighlights.com/grey.gif'); $template = str_replace('', $lazy_content, $template); //替换内容中广告 - $temp_array=array(); + $temp_array = array(); preg_match_all('^^', $template, $temp_array); - if(!empty($temp_array[1])){ - foreach ($temp_array[1] as $key=>$item){ - $tips_detail= $this->recommends_and_tips_model->tips_detail($item); - if($tips_detail){ - $template = str_replace($temp_array[0][$key], $tips_detail->it_content, $template); - } + if (!empty($temp_array[1])) { + foreach ($temp_array[1] as $key => $item) { + $tips_detail = $this->recommends_and_tips_model->tips_detail($item); + if ($tips_detail) { + $template = str_replace($temp_array[0][$key], $tips_detail->it_content, $template); + } } } @@ -883,7 +894,7 @@ class Information extends CI_Controller //$ic_content = '
'.$ic_content.'
'; //兼容拷贝过来的内容样式 //图片加延迟 - $ic_content=$this->html_optimize_lib->set_lazy_loader($ic_content,'https://data.chinatravel.com/images/mobile-first/grey.gif'); + $ic_content = $this->html_optimize_lib->set_lazy_loader($ic_content, 'https://data.chinatravel.com/images/mobile-first/grey.gif'); $ic_content = $this->html_optimize_lib->set_image_size($ic_content); @@ -941,9 +952,9 @@ class Information extends CI_Controller //$apiweb="http://202.103.68.104"; //本地测试 $apiweb = "https://data.chinatravel.com"; if ($device == "mobile") { - $cssUrl = $apiweb . "/css/newcss3/base.css?v=".time(); + $cssUrl = $apiweb . "/css/newcss3/base.css?v=" . time(); } else { - $cssUrl = $apiweb . "/css/newcss3/base.css?v=".time(); + $cssUrl = $apiweb . "/css/newcss3/base.css?v=" . time(); } $main_css_string = compress_css(GET_HTTP($cssUrl)); $data["MAINCSS"] = ''; @@ -985,7 +996,7 @@ class Information extends CI_Controller } if ($addBaseJs) { - $addonJs = ''; + $addonJs = ''; } /// ----- 总JS判断完成----- @@ -997,23 +1008,23 @@ class Information extends CI_Controller } //价格js if ($meta_ct_page_price == "yes") { - $addonJs .= ''; + $addonJs .= ''; } //列表js if (in_array($meta_ct_page_type, array('daytripindex', 'tourindex', 'attractionindex'))) { - $addonJs .= ''; - } + $addonJs .= ''; + } //天气 if (in_array($meta_ct_page_type, array('weatherpage'))) { - $addonJs .= ''; - } + $addonJs .= ''; + } //页面传递参数 $passParam = ""; - if (in_array($meta_ct_page_type, array("daytripindex", "tourindex", "attractionindex","weatherpage"))) { //一日游和线路列表 + if (in_array($meta_ct_page_type, array("daytripindex", "tourindex", "attractionindex", "weatherpage"))) { //一日游和线路列表 //产品首页 $meta_ct_page_value = get_meta($information->ic_id, 'meta_ct_page_value'); @@ -1030,7 +1041,6 @@ class Information extends CI_Controller $passParam .= ''; } - //产品详细页 $productType = ""; @@ -1044,33 +1054,33 @@ class Information extends CI_Controller if (!empty($meta_ct_page_value)) { $productCode = $meta_ct_page_value; } - $addonJs .= ''; + $addonJs .= ''; //$addonJs .= ''; $data["ADDONCSS"] .= ''; } - if ($meta_ct_page_type=="tourdetail"){ + if ($meta_ct_page_type == "tourdetail") { //线路 - $productType=$meta_ct_page_type; + $productType = $meta_ct_page_type; $meta_ct_page_value = get_meta($information->ic_id, 'meta_ct_page_value'); if (!empty($meta_ct_page_value)) { $productCode = $meta_ct_page_value; } //获取cli_sn - $tourdata = json_decode(GET_HTTP($apiurl."/thirdparty/ctmobilefirst/api/getCliSn/?param=".$productCode)); + $tourdata = json_decode(GET_HTTP($apiurl . "/thirdparty/ctmobilefirst/api/getCliSn/?param=" . $productCode)); $data["clisn"] = $tourdata->clisn; } //表单页 - if (in_array($meta_ct_page_type, array("customize", "contactus"))){ - $productType=$meta_ct_page_type; - $addonJs .= ''; + if (in_array($meta_ct_page_type, array("customize", "contactus"))) { + $productType = $meta_ct_page_type; + $addonJs .= ''; $data["ADDONCSS"] .= ''; } $data["productType"] = $productType; - $data["productCode"] = $productCode; + $data["productCode"] = $productCode; //页面添加的元素 @@ -1149,8 +1159,8 @@ class Information extends CI_Controller $data = $this->Information_model->random(1, $root_information->is_path, $exclude_ids); break; case 'rule_this_node_random'://指定节点下随机 - $ir_pointer=$this->Information_model->Detail($recommand->ir_pointer_is_id); - if(!empty($ir_pointer)){ + $ir_pointer = $this->Information_model->Detail($recommand->ir_pointer_is_id); + if (!empty($ir_pointer)) { $data = $this->Information_model->random(1, $ir_pointer->is_path, $exclude_ids); } break; @@ -1164,22 +1174,21 @@ class Information extends CI_Controller return array($recommand->ir_name => false); break; default: //'rule_parent'://继承上级规则则留空,程序会循环一遍分组的规则 - return false; - ; + return false;; } //读取备用节点 if (empty($data) && !empty($recommand->ir_urls)) {//查不到信息并且备选urls不为空,则随机选一条 // $url_array = explode("\n", $recommand->ir_urls); // $data = $this->Information_model->Detail(trim($url_array[rand(0, count($url_array) - 1)])); $url_array = explode("\n", $recommand->ir_urls); - $data = $this->Information_model->random_range(1,$url_array, $exclude_ids); + $data = $this->Information_model->random_range(1, $url_array, $exclude_ids); } if (!empty($data)) { $exclude_ids[] = $data->is_id; //读取附加移动端图片 - $data->mobile_photo=get_meta($data->ic_id, 'meta_addon_picture_mobile'); - if(empty($data->mobile_photo)){ - $data->mobile_photo='https://data.asiahighlights.com/image/travel-guide/thailand/info-template-recommended.jpg'; + $data->mobile_photo = get_meta($data->ic_id, 'meta_addon_picture_mobile'); + if (empty($data->mobile_photo)) { + $data->mobile_photo = 'https://data.asiahighlights.com/image/travel-guide/thailand/info-template-recommended.jpg'; } } return array($recommand->ir_name => $data); @@ -1212,7 +1221,7 @@ class Information extends CI_Controller } } //print_r($data); - //log_message('error', 'exclude_ids: '.$information->ic_url.' '.implode(',',$exclude_ids)); + //log_message('error', 'exclude_ids: '.$information->ic_url.' '.implode(',',$exclude_ids)); return $data; } @@ -1278,7 +1287,7 @@ class Information extends CI_Controller $destination_url = trim($data['detail']->ic_url); $destination_url = substr($destination_url, 0, strpos($destination_url, '/', 1) + 1); //how to plan - $data['info_howtoplan'] = $this->Information_model->search_by_words($destination_url, array('how', 'plan'),array($data['detail']->is_id)); + $data['info_howtoplan'] = $this->Information_model->search_by_words($destination_url, array('how', 'plan'), array($data['detail']->is_id)); if (empty($data['info_howtoplan'])) { //找不到对应信息则显示备用 $data['info_howtoplan'] = $this->Information_model->Detail('/travelguide/plan-first-trip.htm'); } diff --git a/application/views/mobile_first/ch-next.php b/application/views/mobile_first/ch-next.php index d344d6a3..9a548d1f 100644 --- a/application/views/mobile_first/ch-next.php +++ b/application/views/mobile_first/ch-next.php @@ -1,53 +1,282 @@ -
-
-

Related Articles

-
- -
- <?php echo $info_howtoplan->ic_title; ?> - - + +
+
+

Related Articles

- - - -
- <?php echo $info_besttime->ic_title; ?> - - +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + +
+ <?php echo $recommands['Article F']->ic_title; ?> + + + ic_title; ?> + +
+
+ + + +
- - - - + + + + + + +
+
+

Recommended Tours

- - - -
- <?php echo $info_hotel->ic_title; ?> - - + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ <?php echo $recommands['Tour H']->ic_title; ?> + ic_title; ?> + +
+ + +
- +
+ + + + + + + + + -
\ No newline at end of file diff --git a/application/views/mobile_first/ch-pc.php b/application/views/mobile_first/ch-pc.php index 18776435..9018f155 100644 --- a/application/views/mobile_first/ch-pc.php +++ b/application/views/mobile_first/ch-pc.php @@ -22,11 +22,19 @@ - + @@ -40,12 +48,14 @@