在discuzNT中加入Adsense广告(只在第一楼显示)
生活随笔
收集整理的這篇文章主要介紹了
在discuzNT中加入Adsense广告(只在第一楼显示)
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
前段時(shí)間發(fā)布了一篇關(guān)于在帖子中adsense插入廣告文章http://nt.discuz.net/showtopic-22082.html
但是會(huì)在所有的帖子中都插入廣告,這樣就違反了google中所說最多顯示三個(gè)廣告的規(guī)則,我于是少加修改,只在第一層顯示廣告代碼。修改文件/aspx/1/showtopic.aspx? (1為當(dāng)前模板目錄)
templateBuilder.Append("?<!--用戶信息結(jié)束-->\r\n");templateBuilder.Append("?<div?class=\"Dright2\">\r\n");
templateBuilder.Append("??<div?style=\"padding:0px;height:auto!important;height:280px;min-height:280px;\">\r\n");
??//顯示帖子內(nèi)容
??string?adIframe="";//iframe廣告
??//只在第一樓顯示廣告,否則會(huì)違反google規(guī)則
??if(post["id"].ToString().Trim()=="1")
??{
??adIframe="<div?style=\"float:right;\"><iframe?src=\"http://www.51aspx.com/ads/bbs_topic_view.htm\"?frameborder=\"0\"?scrolling=\"no\"?height=\"250\"?width=\"250\"></iframe></div>";
??}
templateBuilder.Append("????<div?class=\"article\"><h3>"?+?post["title"].ToString().Trim()?+?"</h3><div?id=\"message"?+?post["pid"].ToString().Trim()?+?"\"?class=\"t_msgfont\"?style=\"width:99%\">"+?adIframe?+?post["message"].ToString().Trim()?+?"</div>\r\n");
templateBuilder.Append("????</div>\r\n");
這樣既不會(huì)違反規(guī)則,又達(dá)到了廣告的效果,怎樣?不錯(cuò)吧!
演示效果:http://bbs.51aspx.com/showtopic-434.html
是不是只在第一層顯示阿?
轉(zhuǎn)載于:https://www.cnblogs.com/liudao/archive/2007/07/20/825273.html
總結(jié)
以上是生活随笔為你收集整理的在discuzNT中加入Adsense广告(只在第一楼显示)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: matlab中如何应用regress()
- 下一篇: 最近很火的一首粤语歌