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 @@ + + +
+ +