From cfc08936bc688d0673da0d7587c8d5377ee7998c Mon Sep 17 00:00:00 2001 From: Jimmy Liow Date: Tue, 9 Apr 2024 09:32:50 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B2=BE=E7=AE=80CH=E3=80=81GH=E7=BD=91?= =?UTF-8?q?=E7=AB=99reviews=E4=B8=AA=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/controllers/information.php | 155 +++++++----------- .../views/mobile_first/gh-feedback-list.php | 40 +++++ 2 files changed, 101 insertions(+), 94 deletions(-) create mode 100644 application/views/mobile_first/gh-feedback-list.php diff --git a/application/controllers/information.php b/application/controllers/information.php index 5834ca66..5754cf89 100644 --- a/application/controllers/information.php +++ b/application/controllers/information.php @@ -931,9 +931,11 @@ class Information extends CI_Controller $city_name_string = $feedback_array[1][$index]; $city_name_list = explode(',', $city_name_string); $feedback_list = $this->Feedback_model->get_feedback_by_city_list($city_name_list); + // 防止触发 Google 网络垃圾政策只返回前三条 + $top3_feedback_list = array_slice($feedback_list, 0, 3); $feedback_content = $this->load->view( - $template_path . '-feedback-list', - array('feedback_list' => $feedback_list), + 'mobile_first/ch-feedback-list', + array('feedback_list' => $top3_feedback_list), true ); $information->ic_content = str_replace( @@ -993,18 +995,6 @@ class Information extends CI_Controller } } - $feedback_newest = $this->Feedback_model->get_feedback_newest(); - $feedback_newest_content = $this->load->view( - $template_path . '-feedback-newest', - array('feedback_list' => $feedback_newest), - true - ); - $information->ic_content = str_replace( - '', - $feedback_newest_content, - $information->ic_content - ); - // 天气预报模板 $weather_forecast_content = $this->load->view( $template_path . '-weather-forecast', @@ -1017,7 +1007,6 @@ class Information extends CI_Controller $information->ic_content ); - // 火车票首页搜索框 --zp $template_TrainSearch = ""; if ($information->ic_url == "/china-trains/hometest.htm" || $information->ic_url == "/china-trains/") { @@ -1050,43 +1039,41 @@ class Information extends CI_Controller $meta_product_code = get_meta($information->ic_id, 'meta_product_code'); $meta_google_ad_article = get_meta($information->ic_id, 'meta_google_ad_article'); - //非产品页面 - if (empty ($meta_product_code)) { - - $ads_by_google = !empty ($meta_google_ad_article); - //H1模板替换 - $data_H1 = array(); - $data_H1['infocategory'] = $this->Information_model->get_detail_by_path($information->is_path, 1); //信息所属分类,获取信息顶级节点内容 - $data_H1['author'] = ''; //获取作者信息 - $author = $this->Operator_model->get_author_nikename($information->ic_author); - if (!empty ($author)) { - $data_H1['author'] = $author->OPI_FirstName; - } else { - $author_web = $this->Infoauthors_model->detail_by_id($information->ic_author); //原始作者,可能是在线作者等 - if (!empty ($author_web)) { - $data_H1['author'] = $author_web->a_name; - } - } - // 检查图片地址格式 - $parsed_photo = $information->ic_photo; - $parsed_photo_url = parse_url($information->ic_photo); - if ( - (!isset ($parsed_photo_url['host']) || !isset ($parsed_photo_url['scheme'])) && isset ($parsed_photo_url['path']) - ) { - $parsed_photo = 'https://images.chinahighlights.com' . $parsed_photo_url['path']; + $ads_by_google = !empty($meta_google_ad_article); + //H1模板替换 + $data_H1 = array(); + $data_H1['infocategory'] = $this->Information_model->get_detail_by_path($information->is_path, 1); //信息所属分类,获取信息顶级节点内容 + $data_H1['author'] = ''; //获取作者信息 + $author = $this->Operator_model->get_author_nikename($information->ic_author); + if (!empty ($author)) { + $data_H1['author'] = $author->OPI_FirstName; + } else { + $author_web = $this->Infoauthors_model->detail_by_id($information->ic_author); //原始作者,可能是在线作者等 + if (!empty ($author_web)) { + $data_H1['author'] = $author_web->a_name; } + } - $data_H1['ic_title'] = $information->ic_title; - $data_H1['ic_photo'] = $parsed_photo; - $data_H1['breadcrumb_data'] = $breadcrumb_data; - $data_H1['ads_by_google'] = $ads_by_google; - $data_H1['ic_datetime'] = $information->ic_datetime; - $template_H1 = $this->load->view($template_path . '-h1', $data_H1, true); - $template = str_replace('', $template_H1, $template); + // 检查图片地址格式 + $parsed_photo = $information->ic_photo; + $parsed_photo_url = parse_url($information->ic_photo); + if ( + (!isset ($parsed_photo_url['host']) || !isset ($parsed_photo_url['scheme'])) && isset ($parsed_photo_url['path']) + ) { + $parsed_photo = 'https://images.chinahighlights.com' . $parsed_photo_url['path']; + } - $addthis_widget = $this->load->view($template_path . '-add-this', false, true); - $template = str_replace('', $addthis_widget, $template); + $data_H1['ic_title'] = $information->ic_title; + $data_H1['ic_photo'] = $parsed_photo; + $data_H1['breadcrumb_data'] = $breadcrumb_data; + $data_H1['ads_by_google'] = $ads_by_google; + $data_H1['ic_datetime'] = $information->ic_datetime; + $template_H1 = $this->load->view($template_path . '-h1', $data_H1, true); + $template = str_replace('', $template_H1, $template); + + //非产品页面 + if (empty ($meta_product_code)) { $template = str_replace('?product_code=', '', $template); $article_structured_data_content = $this->load->view( @@ -1105,38 +1092,6 @@ class Information extends CI_Controller $inquiry_form_template = $this->load->view($template_path . '-inquiry-form', array('meta_product_code' => $meta_product_code), true); $template = str_replace('?product_code=', '?product_code=' . $meta_product_code, $template); $information->ic_content = str_replace('', $inquiry_form_template, $information->ic_content); - - $ads_by_google = !empty ($meta_google_ad_article); - //H1模板替换 - $data_H1 = array(); - $data_H1['infocategory'] = $this->Information_model->get_detail_by_path($information->is_path, 1); //信息所属分类,获取信息顶级节点内容 - $data_H1['author'] = ''; //获取作者信息 - $author = $this->Operator_model->get_author_nikename($information->ic_author); - if (!empty ($author)) { - $data_H1['author'] = $author->OPI_FirstName; - } else { - $author_web = $this->Infoauthors_model->detail_by_id($information->ic_author); //原始作者,可能是在线作者等 - if (!empty ($author_web)) { - $data_H1['author'] = $author_web->a_name; - } - } - - // 检查图片地址格式 - $parsed_photo = $information->ic_photo; - $parsed_photo_url = parse_url($information->ic_photo); - if ( - (!isset ($parsed_photo_url['host']) || !isset ($parsed_photo_url['scheme'])) && isset ($parsed_photo_url['path']) - ) { - $parsed_photo = 'https://images.chinahighlights.com' . $parsed_photo_url['path']; - } - - $data_H1['ic_title'] = $information->ic_title; - $data_H1['ic_photo'] = $parsed_photo; - $data_H1['breadcrumb_data'] = $breadcrumb_data; - $data_H1['ads_by_google'] = $ads_by_google; - $data_H1['ic_datetime'] = $information->ic_datetime; - $template_H1 = $this->load->view($template_path . '-h1', $data_H1, true); - $template = str_replace('', $template_H1, $template); } // CH: 1; AH: 28; GH : 33 @@ -1341,7 +1296,6 @@ class Information extends CI_Controller $meta_addon_picture = get_meta($information->ic_id, 'meta_addon_picture'); } - //顶部视频 $meta_news_video = get_meta($information->ic_id, 'meta_news_video'); $meta_video_picture = get_meta($information->ic_id, 'meta_video_picture'); @@ -1976,17 +1930,30 @@ class Information extends CI_Controller } } - $feedback_newest = $this->Feedback_model->get_feedback_newest(); - $feedback_newest_content = $this->load->view( - $template_path . '-feedback-newest', - array('feedback_list' => $feedback_newest), - true - ); - $information->ic_content = str_replace( - '', - $feedback_newest_content, - $information->ic_content - ); + // 动态加载反馈标签,第一个城市不足八条,使用第二城市数据。 + // HTLM:
+ // 解析结果:; Siem Reap,Bangkok + $feedback_array = []; + preg_match_all('^^', $information->ic_content, $feedback_array); + if (!empty ($feedback_array)) { + foreach ($feedback_array[0] as $index => $tag_name) { + $city_name_string = $feedback_array[1][$index]; + $city_name_list = explode(',', $city_name_string); + $feedback_list = $this->Feedback_model->get_feedback_by_city_list($city_name_list); + // 防止触发 Google 网络垃圾政策只返回前三条 + $top3_feedback_list = array_slice($feedback_list, 0, 3); + $feedback_content = $this->load->view( + 'mobile_first/gh-feedback-list', + array('feedback_list' => $top3_feedback_list), + true + ); + $information->ic_content = str_replace( + $tag_name, + $feedback_content, + $information->ic_content + ); + } + } 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')); @@ -2293,11 +2260,11 @@ class Information extends CI_Controller foreach ($feedback_array[0] as $index => $tag_name) { $city_name_string = $feedback_array[1][$index]; $city_name_list = explode(',', $city_name_string); - $feedback_list = $this->Feedback_model->get_feedback_by_city_list($city_name_list); + $feedback_list = $this->Feedback_model->get_feedback_by_city_list($city_name_list); // 防止触发 Google 网络垃圾政策只返回前三条 $top3_feedback_list = array_slice($feedback_list, 0, 3); $feedback_content = $this->load->view( - $template_path . '-feedback-list', + 'mobile_first/ah-feedback-list', array('feedback_list' => $top3_feedback_list), true ); diff --git a/application/views/mobile_first/gh-feedback-list.php b/application/views/mobile_first/gh-feedback-list.php new file mode 100644 index 00000000..45f6f280 --- /dev/null +++ b/application/views/mobile_first/gh-feedback-list.php @@ -0,0 +1,40 @@ + +

Discover real reviews of Highlights Travel Family's best-rated service across trusted platforms.

+
+ + +
+
+ + + + + $feedback) {?> + + + + +
+
+ + +
+
+
\ No newline at end of file