asp学习网: 首页 >> 程序参考 >> 动网论坛楼主帖里加广告的方法

动网论坛楼主帖里加广告的方法

以下的方法是动网论坛7.1楼主帖子标题下和签名上放Google Adsense的方法。

使用的方法是采用IFRAME的方法,GG允许在网页中使用IFRAME的方式展示你的广告。

但是请注意:一个页面只允许使用一个IFRAME广告。

警告:在你的IFRAME的页面里请不要心存任何幻想,比如关键词ZB之类。GOOGLE想的永远比你想的多


再教你一招,动网论坛的发帖机很多,经常是一些垃圾的广告,下面有一个方法可以解决这个问题


http://club.adsenser.org/viewthread.php?tid=20743&extra=page%3D1

1、在楼主帖子标题下内容上显示

后台模板(page_dispbbs) template.html(0) 找到

<script type="text/javascript" language="javascript">
LoadMagicEmot(<xsl:value-of select="$mofaface" />,<xsl:value-of select="/post/postinfo/@topicid"/>;);
</script>
</xsl:if>

在下面添加:

<!--===================首贴加广告==========================-->
<xsl:if test="/post/postinfo/@star =1 and position()=1">
<iframe id="gg_ad" marginwidth="0" marginheight="0" frameborder="0" scrolling="no" src="gg_ad.htm" width="468" height="60"></iframe>
<br />
</xsl:if>

其中的width="468" height="60"可以根据你在google帐户里面设置的广告格式调整。

然后新建一个gg_ad.htm 放到论坛跟目录,文件内容就是你在google帐户里面得到的代码。

2、在楼主签名下显示

后台模板(page_dispbbs) template.html(0) 找到

<xsl:value-of select="$postinfo" disable-output-escaping="yes"/>
</div></xsl:if>

在下面添加

<xsl:if test="/post/postinfo/@star =1 and position()=1">
<iframe id="baidu_ad" marginwidth="0" marginheight="0" frameborder="0" scrolling="no"

src="gg_ad.htm" width="468" height="60"></iframe>
<br />
</xsl:if>

然后新建一个gg_ad.htm 放到论坛跟目录,文件内容就是你在google帐户里面得到的代码。

更新了一下,就是将在楼主签名里面的<iframe id="Baidu_ad"改为了"google_ad",其实对功能没有影响的,但是怕一些朋友误会了:)

如果你对IFRAME有怀疑或者害怕这种展示方式对你不利的话,你可以使用JS调用的方法。

方法如下:

写一个js文件,里面类似如下代码:

document.write("<script type='text/javascript'>")
document.write("google_ad_client = 'pub-12345678910000000';")
document.write("google_ad_width = 160;")
document.write("google_ad_height = 600;")
document.write("google_ad_format = '160x600_as';")
document.write("google_ad_type = 'text_image';")
document.write("google_ad_channel = '123456789';")
document.write("google_color_border = 'efefef';")
document.write("google_color_bg = 'efefef';")
document.write("google_color_link = '0066CC';")
document.write("google_color_text = '000000';")
document.write("google_color_url = '000000';")
document.write("</script>")
document.write("<script type='text/javascript'")
document.write(" src='http://pagead2.googlesyndication.com/pagead/show_ads.js'>")
document.write("</script>")

页面上想调用的地方用如下代码调用即可:

<SCRIPT language="javascript" src="你的js文件路径"></SCRIPT> from:asp学习网/title:动网论坛楼主帖里加广告的方法/ time:2007-1-16 23:54:41

本文主题动网论坛楼主帖里加广告的方法

asp教程 ©2006-2007 aspxuexi.com | 关于站点 | 版权隐私 | 站内搜索
复制或者翻版 请于夜间进行