添加google广告代码和显示H1头部图片

ct-mobile-first
ycc 5 years ago
parent 4c9a39f6ae
commit e5d04c07e0

@ -574,6 +574,14 @@ class Information extends CI_Controller
$mobile_template_H1 = $this->call_mobile_template_H1($mobile_first_template_path, $this->input->post('is_path'), $this->input->post('ic_author'), $this->input->post('ic_title'), $this->input->post('ic_photo'));//H1模板替换
$mobile_template = str_replace('<!--@HEAD_1@-->', $mobile_template_H1, $mobile_template);
$mobile_template = str_replace('<!--@CUSTOM-CONENT@-->', $this->input->post('ic_content'), $mobile_template);
//Google广告代码
if(!empty(get_meta($information->ic_id, 'meta_google_ad_content'))){
$mobile_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"></ins><script>(adsbygoogle = window.adsbygoogle || []).push({});</script>', $mobile_template);
}
if(!empty(get_meta($information->ic_id, 'meta_google_ad_article'))) {
$mobile_template = str_replace('<!--@IN-ARTICLE-GOOGLE@-->', '<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><ins class="adsbygoogle" style="display:block; text-align:center;" data-ad-layout="in-article" data-ad-format="fluid" data-ad-client="ca-pub-4231674166786366" data-ad-slot="5442695494"></ins><script>(adsbygoogle = window.adsbygoogle || []).push({});</script>', $mobile_template);
}
//信息推荐
$template_NEXT = $this->call_mobile_template_NEXT($mobile_first_template_path, $this->input->post('is_id'));
$mobile_template = str_replace('<!--@ARTICLENEXT@-->', $template_NEXT, $mobile_template);
//社媒分享图片
@ -610,6 +618,14 @@ class Information extends CI_Controller
$template_H1 = $this->call_mobile_template_H1($template_path, $this->input->post('is_path'), $this->input->post('ic_author'), $this->input->post('ic_title'), $this->input->post('ic_photo'));//H1模板替换
$template = str_replace('<!--@HEAD_1@-->', $template_H1, $template);
$template = str_replace('<!--@CUSTOM-CONENT@-->', $this->input->post('ic_content'), $template);
//Google广告代码
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"></ins><script>(adsbygoogle = window.adsbygoogle || []).push({});</script>', $template);
}
if(!empty(get_meta($information->ic_id, 'meta_google_ad_article'))) {
$template = str_replace('<!--@IN-ARTICLE-GOOGLE@-->', '<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><ins class="adsbygoogle" style="display:block; text-align:center;" data-ad-layout="in-article" data-ad-format="fluid" data-ad-client="ca-pub-4231674166786366" data-ad-slot="5442695494"></ins><script>(adsbygoogle = window.adsbygoogle || []).push({});</script>', $template);
}
//信息推荐
$template_NEXT = $this->call_mobile_template_NEXT($template_path, $this->input->post('is_id'));
$template = str_replace('<!--@ARTICLENEXT@-->', $template_NEXT, $template);
//社媒分享图片
@ -642,7 +658,7 @@ class Information extends CI_Controller
{
if (empty($ic_photo)) {
$images = get_image_url_by_source($ic_content);
if (!empty($images)) {
if (!empty($images) and !empty($images[1])) {
return $images[1][0];
}
} else {

@ -1463,6 +1463,45 @@ $meta_subnavi_arr = array(
<input class="form-control" type="text" name="ic_photo" id="ic_photo" value="<?php echo $information->ic_photo; ?>" />
<div class="clearfix"></div>
<div id="bind_product_code">
<br/>
<div class="input-group">
<input class="form-control" type="text" name="meta_product_code" id="meta_product_code" placeholder="线路代号" value="<?php echo get_meta($information->ic_id, 'meta_product_code'); ?>" />
<a href="javascript:void(0);" class="btn input-group-addon" onclick="meta('save', '<?php echo $information->ic_id; ?>', 'meta_product_code', $('#meta_product_code').val())">绑定</a>
<a href="javascript:void(0);" class="input-group-addon" onclick="meta('delete', '<?php echo $information->ic_id; ?>', 'meta_product_code', $('#meta_product_code').val())"><i class="text-muted glyphicon glyphtext-muted glyphicon glyphicon-remove"></i></a>
</div>
</div>
<?php if($this->config->item('site_code')=='ch'){ ?>
<script>
function show_ad_mate(mate_name,value){
if($('#'+mate_name).prop("checked")){
meta('save', '<?php echo $information->ic_id; ?>', mate_name, value);
}else{
meta('delete', '<?php echo $information->ic_id; ?>', mate_name, value);
}
}
</script>
<div id="bind_product_code">
<br/>
<div class="input-group">
<label class="checkbox col-xs-24" style="font-weight: normal;margin-top:0;padding-left: 21px;">
<input type="checkbox" name="meta_google_ad_content" id="meta_google_ad_content" onclick="show_ad_mate('meta_google_ad_content','show')" <?php echo empty(get_meta($information->ic_id, 'meta_google_ad_content'))?'':'checked'; ?> />Match Content 广告
</label>
</div>
</div>
<div id="bind_product_code">
<div class="input-group">
<label class="checkbox col-xs-24" style="font-weight: normal;margin-top:0;padding-left: 21px;">
<input type="checkbox" name="meta_google_ad_article" id="meta_google_ad_article" onclick="show_ad_mate('meta_google_ad_article','show')" <?php echo empty(get_meta($information->ic_id, 'meta_google_ad_article'))?'':'checked'; ?> />In Article 广告
</label>
</div>
</div>
<?php } ?>
<?php if($this->config->item('site_code')!=='ch'){ ?>
<label>信息类型</label>
<select name="ic_type" id="ic_type" class="form-control" onselect="" >
<?php
@ -1473,15 +1512,6 @@ foreach ($infoTypeList as $key => $value) {
}?>
</select>
<div id="bind_product_code">
<br/>
<div class="input-group">
<input class="form-control" type="text" name="meta_product_code" id="meta_product_code" placeholder="线路代号" value="<?php echo get_meta($information->ic_id, 'meta_product_code'); ?>" />
<a href="javascript:void(0);" class="btn input-group-addon" onclick="meta('save', '<?php echo $information->ic_id; ?>', 'meta_product_code', $('#meta_product_code').val())">绑定</a>
<a href="javascript:void(0);" class="input-group-addon" onclick="meta('delete', '<?php echo $information->ic_id; ?>', 'meta_product_code', $('#meta_product_code').val())"><i class="text-muted glyphicon glyphtext-muted glyphicon glyphicon-remove"></i></a>
</div>
</div>
<label style="width:48px;">模板</label>
<select name="ic_template" id="ic_template" class="form-control">
<?php
@ -1497,6 +1527,7 @@ foreach ($templateList as $key => $value) {
<option <?php echo $information->ic_show_bread_crumbs == 0 ? 'selected' : false; ?> value="0" >不显示</option>
<option <?php echo $information->ic_show_bread_crumbs == 1 ? 'selected' : false; ?> value="1" >显示</option>
</select>
<?php } ?>
<label>作者</label>
<select name="ic_author" id="ic_author" class="form-control">

@ -1,5 +1,12 @@
<div class=topcontent>
<?php if (!empty($ic_photo)) { ?>
<div class="infotopimage">
<img src="<?php echo 'https://images.chinahighlights.com'.$ic_photo; ?>"
alt="<?php echo !empty($ic_title)?$ic_title:'H1 title Chinahighlights mobile first template'; ?>" class="img-responsive">
</div>
<?php } ?>
<div class="infocategory"><?php echo !empty($infocategory)?$infocategory->ic_url_title:'infocategory'; ?></div>
<h1><?php echo !empty($ic_title)?$ic_title:'H1 title Chinahighlights mobile first template'; ?></h1>
<!--<p class="subheadline">to do</p> -->

@ -156,6 +156,7 @@
</div>
<div id="main_content_next">
<!--@Match-Content-GOOGLE@-->
<!--@ARTICLENEXT@-->
</div>
</div>
@ -252,5 +253,6 @@
</div>
</div>
<script async src="https://s7.addthis.com/js/300/addthis_widget.js#pubid=ra-52170b0a4a301edc"></script>
<!--@IN-ARTICLE-GOOGLE@-->
</body>
</html>

@ -178,6 +178,9 @@
<!--@HEAD_1@-->
<div id="main_content_mobile">
<!--@CUSTOM-CONENT@-->
<!--@Match-Content-GOOGLE@-->
<!--@ARTICLENEXT@-->
</div>
@ -251,5 +254,6 @@
</script>
<script async src="https://s7.addthis.com/js/300/addthis_widget.js#pubid=ra-52170b0a4a301edc"></script>
<!--@IN-ARTICLE-GOOGLE@-->
</body>
</html>
Loading…
Cancel
Save