Google广告与Discuz! 论坛完美结合教程

手册/FAQ (531) 2015-12-25 14:13:25

Discuz 5.5的广告位置很多了,可是放google广告还是觉得不爽,只好自己琢磨代码,方法很简单。

首页修改方法:

1、进后台——论坛管理——模版编辑

2、你正在使用哪个模版就点击它右边的“详情”

3、找到discuz(如果没有,就去默认模版里面找),点后面的“编辑” (如果不能编辑,先去ftp修改文件属性)

4、在你认为合适的位置加入下文提供的代码格式,我的是这样的:找到

<!--{if $whosonlinestatus}-->

在前面加入

以下为引用的内容:

<tbody>

<tr>

<td colspan="3" class="header"><span class="bold">赞助商链接</span>

</td></tr></tbody>

<tbody>

                <tr class="row" onMouseOver="this.style.backgroundColor='{ALTBG1}'" onMouseOut="this.style.backgroundColor='{ALTBG2}'">

                <td width="5%" align="center" valign="middle"><img src="{IMGDIR}/supe_updateusers.gif" alt="" /></td>

<td width="95%" colspan="2" valign="middle" style="word-break: keep-all">

<script type="text/javascript"><!--

google_ad_client = "pub-3626584744060780";

google_ad_width = 728;

google_ad_height = 90;

google_ad_format = "728x90_as";

google_ad_type = "text_image";

//2007-04-25: sample

google_ad_channel = "1605672121";

google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";

google_color_link = "0000FF";

google_color_text = "000000";

google_color_url = "008000";

//-->

</script>

<script type="text/javascript"

  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">

</script>

<script type="text/javascript"><!--

google_ad_client = "pub-3626584744060780";

google_ad_width = 180;

google_ad_height = 90;

google_ad_format = "180x90_0ads_al_s";

//2007-04-25: sample

google_ad_channel = "1605672121";

google_color_border = "FFFFFF";

google_color_bg = "FFFFFF";

google_color_link = "000000";

google_color_text = "000000";

google_color_url = "008000";

//-->

</script>

<script type="text/javascript"

  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">

</script>

</td></tr>

                </tbody>

5、更新缓存,搞定

内页修改方法:

1、进后台——论坛管理——模版编辑

2、你正在使用哪个模版就点击它右边的“详情”

3、找到forumdisplay和viewthread(如果没有,就去默认模版里面找),点后面的“编辑” (如果不能编辑,先去ftp修改文件属性)

4、在你认为合适的位置加入下文提供的代码格式

以下为引用的内容:

<div class="maintable">

        <div class="spaceborder" style="width: {TABLEWIDTH}">

        <table cellspacing="{INNERBORDERWIDTH}" cellpadding="{TABLESPACE}" width="100%" align="center">

<tr>

<td colspan="3" class="header"><span class="bold">赞助商链接</span>

</td></tr></tbody>

<tbody>

                <tr class="row" onMouseOver="this.style.backgroundColor='{ALTBG1}'" onMouseOut="this.style.backgroundColor='{ALTBG2}'">

                <td width="5%" align="center" valign="middle"><img src="{IMGDIR}/supe_updateusers.gif" alt="" /></td>

<td width="95%" colspan="2" valign="middle" style="word-break: keep-all">

<script type="text/javascript"><!--

google_ad_client = "pub-3626584744060780";

google_ad_width = 728;

google_ad_height = 90;

google_ad_format = "728x90_as";

google_ad_type = "text_image";

//2007-04-25: sample

google_ad_channel = "1605672121";

google_color_border = "FFFFFF";

google_color_bg = "FFFFFF";

google_color_link = "0000FF";

google_color_text = "000000";

google_color_url = "008000";

//-->

</script>

<script type="text/javascript"

  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">

</script>

<script type="text/javascript"><!--

google_ad_client = "pub-3626584744060780";

google_ad_width = 180;

google_ad_height = 90;

google_ad_format = "180x90_0ads_al_s";

//2007-04-25: sample

google_ad_channel = "1605672121";

google_color_border = "FFFFFF";

google_color_bg = "FFFFFF";

google_color_link = "000000";

google_color_text = "000000";

google_color_url = "008000";

//-->

</script>

<script type="text/javascript"

  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">

</script>

</td></tr>

</table></div><br></div>

5、更新缓存,搞定!

THE END