信息页面增加单元广告

hotfix/paypal-note
LiaoYijun 4 years ago
parent cd131562eb
commit 339d611500

@ -636,6 +636,8 @@ class Information extends CI_Controller
//非产品页面 //非产品页面
$meta_product_code = get_meta($information->ic_id, 'meta_product_code'); $meta_product_code = get_meta($information->ic_id, 'meta_product_code');
if (empty($meta_product_code)) { if (empty($meta_product_code)) {
$ads_by_google = !empty(get_meta($information->ic_id, 'meta_google_ad_article'));
//H1模板替换 //H1模板替换
$data_H1 = array(); $data_H1 = array();
$data_H1['infocategory'] = $this->Information_model->get_detail_by_path($information->is_path, 1); //信息所属分类,获取信息顶级节点内容 $data_H1['infocategory'] = $this->Information_model->get_detail_by_path($information->is_path, 1); //信息所属分类,获取信息顶级节点内容
@ -644,6 +646,7 @@ class Information extends CI_Controller
$data_H1['ic_title'] = $information->ic_title; $data_H1['ic_title'] = $information->ic_title;
$data_H1['ic_photo'] = $information->ic_photo; $data_H1['ic_photo'] = $information->ic_photo;
$data_H1['breadcrumb_data'] = $breadcrumb_data; $data_H1['breadcrumb_data'] = $breadcrumb_data;
$data_H1['ads_by_google'] = $ads_by_google;
$template_H1 = $this->load->view($template_path . '-h1', $data_H1, TRUE); $template_H1 = $this->load->view($template_path . '-h1', $data_H1, TRUE);
$template = str_replace('<!--@HEAD_1@-->', $template_H1, $template); $template = str_replace('<!--@HEAD_1@-->', $template_H1, $template);
@ -734,10 +737,6 @@ class Information extends CI_Controller
//if (!empty(get_meta($information->ic_id, 'meta_google_ad_content'))) { //if (!empty(get_meta($information->ic_id, 'meta_google_ad_content'))) {
$template = str_replace('<!--@Match-Content-GOOGLE@-->', '<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><ins class="adsbygoogle" style="display:block" data-ad-format="autorelaxed" data-ad-client="ca-pub-4231674166786366" data-ad-slot="1447610161" data-matched-content-rows-num="2,2" data-matched-content-columns-num="1,3" data-matched-content-ui-type="image_stacked,image_stacked"></ins><script>(adsbygoogle = window.adsbygoogle || []).push({});</script>', $template); $template = str_replace('<!--@Match-Content-GOOGLE@-->', '<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><ins class="adsbygoogle" style="display:block" data-ad-format="autorelaxed" data-ad-client="ca-pub-4231674166786366" data-ad-slot="1447610161" data-matched-content-rows-num="2,2" data-matched-content-columns-num="1,3" data-matched-content-ui-type="image_stacked,image_stacked"></ins><script>(adsbygoogle = window.adsbygoogle || []).push({});</script>', $template);
//} //}
if (!empty(get_meta($information->ic_id, 'meta_google_ad_article'))) {
$in_article_google = $this->load->view($template_path . '-google-ad', false, true);
$template = str_replace('<!--@IN-ARTICLE-GOOGLE@-->', $in_article_google, $template);
}
//社媒分享图片 //社媒分享图片
if (!empty($information->ic_photo)) { if (!empty($information->ic_photo)) {
$full_ic_photo = $this->config->item('site_image_url') . $information->ic_photo; $full_ic_photo = $this->config->item('site_image_url') . $information->ic_photo;

@ -17,5 +17,24 @@
<h1><?php echo !empty($ic_title)?$ic_title:'H1 title Chinahighlights mobile first template'; ?></h1> <h1><?php echo !empty($ic_title)?$ic_title:'H1 title Chinahighlights mobile first template'; ?></h1>
<!--<p class="subheadline">to do</p> --> <!--<p class="subheadline">to do</p> -->
<div class="authorupdate">By <strong><?php echo !empty($author)?$author->OPI_FirstName:'author nickname'; ?></strong>Updated <?php echo date("M. j, Y",time()); ?></div> <div class="authorupdate">By <strong><?php echo !empty($author)?$author->OPI_FirstName:'author nickname'; ?></strong>Updated <?php echo date("M. j, Y",time()); ?></div>
<?php if ($ads_by_google) { ?>
<style>
#adsense-head-ads {
height: 427px;
min-height: 427px;
background: url(https://data.viaggio-in-cina.it/information-view/information/img/adsense.gif) center center no-repeat;
}
@media screen and (max-width: 767px) {
#adsense-head-ads {
height: 320px;
min-height: 320px;
}
}
</style>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4231674166786366"
crossorigin="anonymous"></script>
<ins id="adsense-head-ads" class="adsbygoogle" style="display:block" data-ad-client="ca-pub-4231674166786366" data-ad-slot="1166484387" data-ad-format="auto" data-full-width-responsive="true"></ins>
<script>(adsbygoogle = window.adsbygoogle || []).push({});</script>
<?php } ?>
</section> </section>
</div> </div>

Loading…
Cancel
Save