From 74a0d877702116d2fabf4aaa23a2839cf607eb13 Mon Sep 17 00:00:00 2001 From: ycc Date: Wed, 9 Dec 2020 11:41:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=94=9F=E6=88=90pc=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/controllers/information.php | 30 +++ application/views/mobile_first/ch-pc.php | 228 +++++++++++++++++++++++ application/views/mobile_first/ch.php | 2 +- 3 files changed, 259 insertions(+), 1 deletion(-) create mode 100644 application/views/mobile_first/ch-pc.php diff --git a/application/controllers/information.php b/application/controllers/information.php index 0d66ef27..ead4ec2f 100644 --- a/application/controllers/information.php +++ b/application/controllers/information.php @@ -486,6 +486,7 @@ class Information extends CI_Controller }else if (strcasecmp($site_code, "ch") == 0 && !empty($auto_update_cache)) { //读取模板生成PC和移动优先文件 $this->make_mobile_html(); + $this->make_pc_html(); } else if (strcasecmp($site_code, "cht") == 0 && !empty($auto_update_cache)) { $update_info_log = $this->update_cache($ic_url); } else if (strcasecmp($site_code, "ah") == 0 && !empty($auto_update_cache)) { @@ -585,6 +586,35 @@ class Information extends CI_Controller file_put_contents($mobile_html, $mobile_template, LOCK_EX); } + + function make_pc_html(){ + $data=array(); + //获取PC的模板,如果有的话 + $template_path='mobile_first/'.$this->config->item('site_code'); + if(is_file(APPPATH.'views/'.$template_path.'-pc'.EXT)){ + $template=$this->load->view($template_path.'-pc', '', TRUE); + }else{ + return false; + } + $template=str_replace('', $this->input->post('ic_seo_title'), $template); + $template=str_replace('', $this->input->post('ic_seo_description'), $template); + $template=str_replace('', $this->input->post('ic_seo_keywords'), $template); + $template=str_replace('', $this->input->post('site_url').$this->input->post('ic_url'), $template); + $template_H1=$this->call_mobile_template_H1($template_path,$this->input->post('is_parent_id'),$this->input->post('ic_author'),$this->input->post('ic_title'));//H1模板替换 + $template=str_replace('', $template_H1, $template); + $template=str_replace('', $this->input->post('ic_content'), $template); + + // /travelguide/chinese-zodiac/monthly-fortune-for-dog.htm + $html_path=$this->config->item('cache')[$this->config->item('site_code')]['cache_path'].$this->input->post('ic_url'); + $html_path=str_replace("\\", "/", $html_path); + if(substr($html_path, -1, 1)== '/'){ + $html_path=$html_path.'index.htm'; + } + $html_path.='-pc.htm'; + create_folder_by_path(dirname($html_path)); + file_put_contents($html_path, $template, LOCK_EX); + } + function call_mobile_template_H1($mobile_first_template_path,$is_parent_id,$ic_author,$ic_title){ $data['infocategory']=$this->Information_model->Detail($is_parent_id);//信息所属分类,获取信息父级节点url title $data['author']=$this->Operator_model->get_author_nikename($ic_author);//获取作者信息 diff --git a/application/views/mobile_first/ch-pc.php b/application/views/mobile_first/ch-pc.php new file mode 100644 index 00000000..c8ec4cf4 --- /dev/null +++ b/application/views/mobile_first/ch-pc.php @@ -0,0 +1,228 @@ + + + + + <!--@TITLE@--> + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+

+
+
+ + +
+
+
+
+ +
+
About Us
+
China Highlights tailor-makes China tours to help travelers discover China their way. We're a passionate team of one hundred avid travelers who love to share our knowledge of China with those looking for a more authentic travel experience, more ...
+ + +
+ + +
+
Follow Us
+ + + +
+ +
+ + +
+ +
Featured on
+ xxx + + +
+
+
+ +
+
+ + + \ No newline at end of file diff --git a/application/views/mobile_first/ch.php b/application/views/mobile_first/ch.php index 4c475e16..8feb0231 100644 --- a/application/views/mobile_first/ch.php +++ b/application/views/mobile_first/ch.php @@ -166,7 +166,7 @@

-
+