diff --git a/application/controllers/information.php b/application/controllers/information.php index 6e33441d..a7676f00 100644 --- a/application/controllers/information.php +++ b/application/controllers/information.php @@ -610,19 +610,19 @@ class Information extends CI_Controller // HTLM:
// 解析结果:, Shanghai $feedback_array = []; - preg_match_all('^^', $template, $feedback_array); + preg_match_all('^^', $information->ic_content, $feedback_array); if (!empty($feedback_array)) { foreach ($feedback_array[0] as $index => $tag_name) { $city_name = $feedback_array[1][$index]; - $feedback_data = $this->feedback_model->get_feedback_by_city($city_name); + $feedback_data = $this->Feedback_model->get_feedback_by_city($city_name); $feedback_content = $this->load->view( $template_path . '-feedback', array('feedback_data' => $feedback_data), true); - $template = str_replace( + $information->ic_content = str_replace( $tag_name, $feedback_content, - $template); + $information->ic_content); } } diff --git a/application/controllers/test.php b/application/controllers/test.php index 7a7efa6b..f66a6e05 100644 --- a/application/controllers/test.php +++ b/application/controllers/test.php @@ -14,22 +14,23 @@ class Test extends CI_Controller } + // https://cht.mycht.cn/info.php/test/feedback/?tag=%3Chtml%3E%3Cdiv%3E%3C!--%40FEEDBACK_Shanghai%40--%3E%3C%2Fdiv%3E%3C%2Fhtml%3E public function feedback() { - $is_id = $this->input->get_post('is_id'); + $tag = $this->input->get_post('tag'); $template_path = 'mobile_first/ch'; - $information = $this->Information_model->Detail($is_id); $feedback_array = array(); - preg_match_all('^^', $information->ic_content, $feedback_array); + preg_match_all('^^', $tag, $feedback_array); if (!empty($feedback_array)) { foreach ($feedback_array[0] as $index => $tag_name) { $city_name = $feedback_array[1][$index]; - echo $information->ic_title.'
'; - echo $city_name.'
'; - echo htmlentities($tag_name).'
'; + echo 'city_name: '.$city_name.'
'; + echo 'tag_name: '.htmlentities($tag_name).'
'; + echo 'feedback_data:
'; $feedback_data = $this->feedback_model->get_feedback_by_city($city_name); + var_dump($feedback_data); $feedback_content = $this->load->view( $template_path . '-feedback', array('feedback_data' => $feedback_data), diff --git a/application/models/feedback_model.php b/application/models/feedback_model.php index 11a0f8e8..3defcc51 100644 --- a/application/models/feedback_model.php +++ b/application/models/feedback_model.php @@ -7,6 +7,9 @@ class Feedback_model extends CI_Model { $this->HT = $this->load->database('HT', TRUE); } + /** + * 根据城市英文名查找最新一条反馈信息 + */ function get_feedback_by_city($city_name) { $feedback_query = diff --git a/application/views/mobile_first/ch-feedback.php b/application/views/mobile_first/ch-feedback.php index fc5c994f..33d3273e 100644 --- a/application/views/mobile_first/ch-feedback.php +++ b/application/views/mobile_first/ch-feedback.php @@ -1,14 +1,14 @@ -
-

About China Highlights

-

Since 1959 we've guided everyone ranging from US presidents, Australian Geographic and retired backpackers. Our goal is to create unique trips that take you off-the-beaten path, helping you discover China in a more authentic way. Our motto: "Discovery Your Way!"

-
travelers' choice 2020 -
+ +
+

About China Highlights

+
travelers' choice 2021
+

Since 1959 we've guided everyone ranging from US presidents, Australian Geographic and retired backpackers. Our goal is to create unique trips that take you off-the-beaten path, helping you discover China in a more authentic way. Our motto: "Discovery Your Way!"

+
+ - \ No newline at end of file +
\ No newline at end of file