diff --git a/application/controllers/information.php b/application/controllers/information.php index d7946fea..0d66ef27 100644 --- a/application/controllers/information.php +++ b/application/controllers/information.php @@ -329,7 +329,7 @@ class Information extends CI_Controller //获取移动优先的模板,如果有的话 $mobile_first_template_path='mobile_first/'.$this->config->item('site_code'); if(is_file(APPPATH.'views/'.$mobile_first_template_path.EXT)){ - $mobile_template_H1=$this->load->view($mobile_first_template_path.'-h1', '', TRUE); + $mobile_template_H1=$this->call_mobile_template_H1($mobile_first_template_path,$data['information']->is_parent_id,$data['information']->ic_author,$data['information']->ic_title);//H1模板替换 $data['mobile_first_template']=$this->load->view($mobile_first_template_path, '', TRUE); $data['mobile_first_template']=str_replace('', $mobile_template_H1, $data['mobile_first_template']); }else{ @@ -570,11 +570,7 @@ class Information extends CI_Controller $mobile_template=str_replace('', $this->input->post('ic_seo_description'), $mobile_template); $mobile_template=str_replace('', $this->input->post('ic_seo_keywords'), $mobile_template); $mobile_template=str_replace('', $this->input->post('site_url').$this->input->post('ic_url'), $mobile_template); - //H1模板替换 - $data['infocategory']=$this->Information_model->Detail($this->input->post('is_parent_id'));//信息所属分类,获取信息父级节点url title - $data['author']=$this->Operator_model->get_author_nikename($this->input->post('ic_author'));//获取作者信息 - $data['ic_title']=$this->input->post('ic_title'); - $mobile_template_H1=$this->load->view($mobile_first_template_path.'-h1', $data, TRUE); + $mobile_template_H1=$this->call_mobile_template_H1($mobile_first_template_path,$this->input->post('is_parent_id'),$this->input->post('ic_author'),$this->input->post('ic_title'));//H1模板替换 $mobile_template=str_replace('', $mobile_template_H1, $mobile_template); $mobile_template=str_replace('', $this->input->post('ic_content'), $mobile_template); @@ -589,6 +585,13 @@ class Information extends CI_Controller file_put_contents($mobile_html, $mobile_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);//获取作者信息 + $data['ic_title']=$ic_title; + return $this->load->view($mobile_first_template_path.'-h1', $data, TRUE); + } + //更新静态文件 //不用参数提交的原因是可能url带有特殊字符,CI会报错 public function update_cache($static_html_url = false, $delete_only = false)