From 6b2f5f0671c581e66e47f34740c91ca5c56f4e01 Mon Sep 17 00:00:00 2001 From: Jimmy Liow Date: Tue, 2 Apr 2024 14:42:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E5=B9=B6=E4=BA=A7=E5=93=81=E9=A1=B5?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E9=A1=B5=E5=A4=B4=E9=83=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/controllers/information.php | 33 +++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/application/controllers/information.php b/application/controllers/information.php index a905f94d..599b2b76 100644 --- a/application/controllers/information.php +++ b/application/controllers/information.php @@ -1094,8 +1094,37 @@ class Information extends CI_Controller $template = str_replace('?product_code=', '?product_code=' . $meta_product_code, $template); $information->ic_content = str_replace('', $inquiry_form_template, $information->ic_content); - $breadcrumb_content = $this->load->view($template_path . '-breadcrumb', array('breadcrumb_data' => $breadcrumb_data), true); - $information->ic_content = str_replace('', $breadcrumb_content, $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