diff --git a/application/controllers/information.php b/application/controllers/information.php index e3250954..0e3c1cc4 100644 --- a/application/controllers/information.php +++ b/application/controllers/information.php @@ -514,11 +514,11 @@ class Information extends CI_Controller $recommand_information = $this->recommand_information($information); //用于批量更新,CH和chinatravel分开 ,20210317 zp if ($this->config->item('site_code') == 'ch') { - $this->make_www_cache('pc', $information,$recommand_information); - $this->make_www_cache('mobile', $information,$recommand_information); + $this->make_www_cache('pc', $information, $recommand_information); + $this->make_www_cache('mobile', $information, $recommand_information); } else if ($this->config->item('site_code') == 'ah') { - $this->make_www_cache_ah('pc', $information,$recommand_information); - $this->make_www_cache_ah('mobile', $information,$recommand_information); + $this->make_www_cache_ah('pc', $information, $recommand_information); + $this->make_www_cache_ah('mobile', $information, $recommand_information); } else if ($this->config->item('site_code') == 'chinatravel') { $this->make_www_cache_ct($information); // $this->make_www_cache_ct('mobile', $information); @@ -957,57 +957,46 @@ class Information extends CI_Controller $meta_addon_picture = get_meta($information->ic_id, 'meta_addon_picture'); } - //非产品页面 $meta_product_code = get_meta($information->ic_id, 'meta_product_code'); - if (empty($meta_product_code)) { - - $ads_by_google = !empty(get_meta($information->ic_id, 'meta_google_ad_article')); - //H1模板替换 - $data_H1 = array(); - $data_H1['infocategory'] = $this->Information_model->get_detail_by_path($information->is_path, 1); //信息所属分类,获取信息顶级节点内容 - $author = $this->Operator_model->get_author_nikename($information->ic_author); - $data_H1['author'] = $author; //获取作者信息 - $data_H1['ic_title'] = $information->ic_title; - $data_H1['ic_photo'] = $meta_addon_picture;//$information->ic_photo; 用额外设置的图片替代 - $data_H1['breadcrumb_data'] = $breadcrumb_data; - $data_H1['ads_by_google'] = $ads_by_google; - $template_H1 = $this->load->view($template_path . '-h1', $data_H1, TRUE); - $template = str_replace('', $template_H1, $template); + $ads_by_google = !empty(get_meta($information->ic_id, 'meta_google_ad_article')); + //H1模板替换 + $data_H1 = array(); + $data_H1['infocategory'] = $this->Information_model->get_detail_by_path($information->is_path, 1); //信息所属分类,获取信息顶级节点内容 + $author = $this->Operator_model->get_author_nikename($information->ic_author); + $data_H1['author'] = $author; //获取作者信息 + $data_H1['ic_title'] = $information->ic_title; + $data_H1['ic_photo'] = $meta_addon_picture;//$information->ic_photo; 用额外设置的图片替代 + $data_H1['breadcrumb_data'] = $breadcrumb_data; + $data_H1['ads_by_google'] = $ads_by_google; + $template_H1 = $this->load->view($template_path . '-h1', $data_H1, TRUE); + $template = str_replace('', $template_H1, $template); // $addthis_widget = $this->load->view($template_path . '-add-this', false, true); // $template = str_replace('', $addthis_widget, $template); - $article_structured_data_content = $this->load->view( - $template_path . '-structured-data-article', - array('information' => $information, 'author' => $author), - true); - $template = str_replace('', $article_structured_data_content, $template); - } else { -// $template = str_replace('', '', $template); -// $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); -// $information->ic_content = str_replace('', $breadcrumb_content, $information->ic_content); - } + $article_structured_data_content = $this->load->view( + $template_path . '-structured-data-article', + array('information' => $information, 'author' => $author), + true); + $template = str_replace('', $article_structured_data_content, $template); //信息推荐 $template_recommand = $recommand_information; //$this->recommand_information($information); 从外面传进来,pc和移动只需要查一次,减少数据库负担 $template = str_replace('', $this->load->view($template_path . '-next', array('recommands' => $template_recommand), TRUE), $template); // //广告,改叫tips,防止被插件屏蔽 if (!empty($template_recommand['Tips Right TOP'])) { - // $template = str_replace('', "
", $template); + // $template = str_replace('', "
", $template); } if (!empty($template_recommand['Tips Right'])) { - // $template = str_replace('', "
" . $template_recommand['Tips Right']->it_content . "
", $template); + // $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); + // $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); + // $information->ic_content = str_replace('', $this->load->view($template_path . '-recommends-tour', array('recommands' => $template_recommand), TRUE), $information->ic_content); } //替换内容中广告 @@ -1023,7 +1012,6 @@ class Information extends CI_Controller } - if (is_file('D:/wwwroot/origin-www.globalhighlights.com/css/gh-global.css')) {//主样式表,内联模式,优先读取本地,没有在从网络读取,为了加速 $main_css_string = compress_css(file_get_contents('D:/wwwroot/origin-www.globalhighlights.com/css/gh-global.css')); } else { @@ -1033,11 +1021,11 @@ class Information extends CI_Controller //额外样式 $meta_addon_css = get_meta($information->ic_id, 'meta_addon_css'); if (!empty($meta_addon_css)) { - // if ($meta_addon_css == 'https://proxy-data.chinahighlights.com/css/tour-detail-former.css' && is_file('D:/wwwroot/origin-data.chinahighlights.com/css/tour-detail-former.css')) { - //$meta_addon_css_string = compress_css(file_get_contents('D:/wwwroot/origin-data.chinahighlights.com/css/tour-detail-former.css')); - // } else { - $meta_addon_css_string = compress_css(GET_HTTP($meta_addon_css)); - // } + // if ($meta_addon_css == 'https://proxy-data.chinahighlights.com/css/tour-detail-former.css' && is_file('D:/wwwroot/origin-data.chinahighlights.com/css/tour-detail-former.css')) { + //$meta_addon_css_string = compress_css(file_get_contents('D:/wwwroot/origin-data.chinahighlights.com/css/tour-detail-former.css')); + // } else { + $meta_addon_css_string = compress_css(GET_HTTP($meta_addon_css)); + // } $template = str_replace('', '', $template); } //额外js @@ -1051,7 +1039,7 @@ class Information extends CI_Controller //替换内容中各种标签 //$tag_why_us = $this->load->view($template_path . '-why-us', false, true); - // $template = str_replace('', $tag_why_us, $template); + // $template = str_replace('', $tag_why_us, $template); //Google广告代码 //if (!empty(get_meta($information->ic_id, 'meta_google_ad_content'))) { @@ -1276,12 +1264,12 @@ class Information extends CI_Controller //面包屑 $crumb = ""; $crumb_data = $this->Information_model->get_path_exclude_ct($information->is_id, $information->is_path); - if (count($crumb_data)>0){ //至少有一个父类面包屑才显示 + if (count($crumb_data) > 0) { //至少有一个父类面包屑才显示 $crumb = "
Home"; foreach ($crumb_data as $index => $item) { - $crumb .= ''.$item['ic_url_title'].''; + $crumb .= '' . $item['ic_url_title'] . ''; } - $crumb .="
"; + $crumb .= ""; } $data["crumb"] = $crumb; /* 详细内容 */ @@ -1303,8 +1291,8 @@ class Information extends CI_Controller // },$ic_content); /** 替换H1加面包屑 */ - $ic_content = preg_replace('/

(.*)<\/h1>/i',$crumb."\r\n".'

$1

',$ic_content,1); - + $ic_content = preg_replace('/

(.*)<\/h1>/i', $crumb . "\r\n" . '

$1

', $ic_content, 1); + //图片加延迟 $ic_content = $this->html_optimize_lib->set_lazy_loader($ic_content, 'https://data.chinatravel.com/images/mobile-first/grey.gif'); @@ -1460,7 +1448,7 @@ class Information extends CI_Controller } //表单页 - if (in_array($meta_ct_page_type, array("customize", "contactus","pagewithform"))) { + if (in_array($meta_ct_page_type, array("customize", "contactus", "pagewithform"))) { $productType = $meta_ct_page_type; $addonJs .= ''; $data["ADDONCSS"] .= '';