[MOD]标题中隐藏的google广告

PHPBB2.0.X资源收集专用版,提问和建议请发到主版面
Locked
User avatar
IOsetting
论坛管理员
论坛管理员
Posts: 3647
Joined: 2006-10-17 1:48

[MOD]标题中隐藏的google广告

Post by IOsetting » 2007-04-27 22:07

标题广告MOD,适用于Google - 其他的没有尝试过

前提:
有google adsense的帐号,申请一个并生成一个Adsense for Content ->Ad unit(234x60, Half Banner),拷贝其代码如下:

<script type="text/javascript"><!--
google_ad_client = "pub-????????????????";
google_ad_width = 234;
google_ad_height = 60;
google_ad_format = "234x60_as";
google_ad_type = "text_image";
google_ad_channel = "";
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

记住自己的????????????????????中的内容。以上代码粘贴到文本文件备用。

以下需要修改五个文件:
viewforum.php
templates/phpbbchina/viewforum_body.tpl
templates/phpbbchina/viewforum_threads.tpl (如果没有这文件,略去这一步)
templates/subSilver/viewforum_body.tpl
templates/subSilver/viewforum_threads.tpl(如果没有这文件,略去这一步)


打开viewforum.php
找到

Code: Select all

for($i = 0; $i < $total_topics; $i++)
前面添加

Code: Select all

	$topic_adinserted = false;
找到

Code: Select all

'U_VIEW_TOPIC' => $view_topic_url)
		);
后面添加

Code: Select all

if (!$topic_adinserted && !$userdata['session_logged_in'] && $topic_rowset[$i]['topic_type'] == POST_NORMAL && rand(1, 7) > 5)
		{
			$newest_post_img = '<img src="' . $images['icon_newest_reply'] . '" alt="' . $lang['View_newest_post'] . '" title="' . $lang['View_newest_post'] . '" border="0" />';
			$folder_image = $folder_new;
			
			$template->assign_block_vars('topicrow.topicadrow', array(
				'ROW_COLOR' => $row_color,
				'ROW_CLASS' => $row_class,
				'FORUM_ID' => $forum_id,
				'TOPIC_ID' => $topic_id,
				'TOPIC_FOLDER_IMG' => $folder_image, 
				'TOPIC_EXPEND_IMG' => $images['folder_minus'],
				'XS_NEW' => intval($folder_image_flag),
				'GOTO_PAGE' => $goto_page,
				'REPLIES' => $replies,
				'NEWEST_POST_IMG' => $newest_post_img, 
				'TOPIC_ATTACHMENT_IMG' => topic_attachment_image($topic_rowset[$i]['topic_attachment']),
				'VIEWS' => $views,
				'FIRST_POST_TIME' => $first_post_time, 
				'LAST_POST_TIME' => $last_post_time, 
				'LAST_POST_IMG' => $last_post_url, 
				'NODE_NUMBER' => 'node_'.$topic_id,
				'L_TOPIC_FOLDER_ALT' => $folder_alt)
			);
			$topic_adinserted = true;
		}
以下一共要添加四段代码,其中有??????????????????的请用自己的google ads代号(前面生成的代码中取得)代替。

打开templates/phpbbchina/viewforum_body.tpl
找到

Code: Select all

	<!-- END topicrow -->
前面添加

Code: Select all

	<!-- BEGIN topicadrow -->
	<tr> 
	  <td class="row1" align="center" valign="middle"><img src="{topicrow.topicadrow.TOPIC_FOLDER_IMG}" alt="{topicrow.topicadrow.L_TOPIC_FOLDER_ALT}" title="{topicrow.topicadrow.L_TOPIC_FOLDER_ALT}" /></td>
	  <td class="row1h<!-- IF topicrow.topicadrow.XS_NEW -->-new<!-- ENDIF --> row-forum" width="100%"><span class="topictitle">{topicrow.topicadrow.NEWEST_POST_IMG}{topicrow.topicadrow.TOPIC_ATTACHMENT_IMG}
	  <script type="text/javascript"><!--
				google_ad_client = "pub-????????????????????";
				google_alternate_color = "F8F8F8";
				google_ad_width = 234;
				google_ad_height = 16;
				google_ad_format = "234x60_as";
				google_ad_type = "text_image";
				google_ad_channel = "";
				google_color_border = "F8F8F8";
				google_color_bg = "F8F8F8";
				google_color_link = "455995";
				google_color_text = "455995";
				google_color_url = "455995";
				//-->
				</script>
				<script type="text/javascript"
				  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
	  </script></span>
	  <br /><span class="gensmall">{topicrow.topicadrow.GOTO_PAGE}</span></td>
	  <td class="row2" align="center" valign="middle"><span class="postdetails">{topicrow.topicadrow.REPLIES}</span></td>
	  <td class="row2" align="center" valign="middle"><span class="postdetails">{topicrow.topicadrow.VIEWS}</span></td>
	  <td class="row3" align="center" valign="middle" nowrap="nowrap"><span class="name"><a href=#>Google</a></span><br /><span class="date">{topicrow.topicadrow.FIRST_POST_TIME}</span></td>
	  <td class="row4" align="center" valign="middle" nowrap="nowrap"><span class="name"><a href=#>Google</a> {topicrow.topicadrow.LAST_POST_IMG}</span><br /><span class="date">{topicrow.topicadrow.LAST_POST_TIME}</span></td>
	</tr>
	<!-- END topicadrow -->
打开templates/phpbbchina/viewforum_threads.tpl
找到

Code: Select all

	<!-- END topicrow -->
前面添加

Code: Select all

	<!-- BEGIN topicadrow -->
	<tr> 
	  <td class="row1" align="center" valign="middle"><img src="{topicrow.topicadrow.TOPIC_FOLDER_IMG}" alt="{topicrow.topicadrow.L_TOPIC_FOLDER_ALT}" title="{topicrow.topicadrow.L_TOPIC_FOLDER_ALT}" /></td>
	  <td class="row1 row-forum" width="100%"><span class="topictitle">{topicrow.topicadrow.NEWEST_POST_IMG}{topicrow.topicadrow.TOPIC_ATTACHMENT_IMG}
	  <script type="text/javascript"><!--
				google_ad_client = "pub-????????????????????";
				google_alternate_color = "F8F8F8";
				google_ad_width = 234;
				google_ad_height = 15;
				google_ad_format = "234x60_as";
				google_ad_type = "text_image";
				google_ad_channel = "";
				google_color_border = "F8F8F8";
				google_color_bg = "F8F8F8";
				google_color_link = "455995";
				google_color_text = "455995";
				google_color_url = "455995";
				//-->
				</script>
				<script type="text/javascript"
				  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
	  </script></span>
	  <span class="gensmall"> {topicrow.topicadrow.GOTO_PAGE}
	  [{topicrow.topicadrow.REPLIES}/{topicrow.topicadrow.VIEWS}]</span> - 
	  <span class="name"><a href=#>Google</a></span> - 
	  <span class="date">{topicrow.topicadrow.FIRST_POST_TIME}</span> 
	  </td>
	</tr>
	<!-- END topicadrow -->
打开templates/subSilver/viewforum_body.tpl
找到

Code: Select all

	<!-- END topicrow -->
前面添加

Code: Select all

	<!-- BEGIN topicadrow -->
	<tr> 
	  <td class="row1" align="center" valign="middle" width="20"><img src="{topicrow.topicadrow.TOPIC_FOLDER_IMG}" width="19" height="18" alt="{topicrow.topicadrow.L_TOPIC_FOLDER_ALT}" title="{topicrow.topicadrow.L_TOPIC_FOLDER_ALT}" /></td>
	  <td class="row1" width="100%">{topicrow.topicadrow.NEWEST_POST_IMG}{topicrow.topicadrow.TOPIC_ATTACHMENT_IMG}
	  <script type="text/javascript"><!--
				google_ad_client = "pub-????????????????????";
				google_alternate_color = "EFEFEF";
				google_ad_width = 234;
				google_ad_height = 17;
				google_ad_format = "234x60_as";
				google_ad_type = "text_image";
				google_ad_channel = "";
				google_color_border = "EFEFEF";
				google_color_bg = "EFEFEF";
				google_color_link = "5493B4";
				google_color_text = "5493B4";
				google_color_url = "5493B4";
				//-->
				</script>
				<script type="text/javascript"
				  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
	  </script>
	  <br /><span class="gensmall">{topicrow.topicadrow.GOTO_PAGE}</span></td>
	  <td class="row2" align="center" valign="middle"><span class="postdetails">{topicrow.topicadrow.REPLIES}</span></td>
	  <td class="row3" align="center" valign="middle"><span class="name"><a href="#">Google</a></span></td>
	  <td class="row2" align="center" valign="middle"><span class="postdetails">{topicrow.topicadrow.VIEWS}</span></td>
	  <td class="row3Right" align="right" valign="middle" nowrap="nowrap"><span class="postdetails">{topicrow.topicadrow.LAST_POST_TIME}<br /><a href="#">Google</a> {topicrow.topicadrow.LAST_POST_IMG}</span></td>
	</tr>
	<!-- END topicadrow -->

打开templates/subSilver/viewforum_threads.tpl
找到

Code: Select all

	<!-- END topicrow -->
前面添加

Code: Select all

	<!-- BEGIN topicadrow -->
	<tr> 
	  <td class="row1" align="center" valign="middle" width="20"><img src="{topicrow.topicadrow.TOPIC_FOLDER_IMG}" width="19" height="18" alt="{topicrow.topicadrow.L_TOPIC_FOLDER_ALT}" title="{topicrow.topicadrow.L_TOPIC_FOLDER_ALT}" /></td>
	  <td class="row1" width="100%">{topicrow.topicadrow.NEWEST_POST_IMG}{topicrow.topicadrow.TOPIC_ATTACHMENT_IMG}
	  <script type="text/javascript"><!--
				google_ad_client = "pub-????????????????????";
				google_alternate_color = "EFEFEF";
				google_ad_width = 234;
				google_ad_height = 17;
				google_ad_format = "234x60_as";
				google_ad_type = "text_image";
				google_ad_channel = "";
				google_color_border = "EFEFEF";
				google_color_bg = "EFEFEF";
				google_color_link = "5493B4";
				google_color_text = "5493B4";
				google_color_url = "5493B4";
				//-->
				</script>
				<script type="text/javascript"
				  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
	  </script>
	  <span class="gensmall"> {topicrow.topicadrow.GOTO_PAGE}
		[{topicrow.topicadrow.REPLIES}/{topicrow.topicadrow.VIEWS}]</span> &nbsp;&nbsp;&raquo; 
		<span class="name"><a href="#">Google</a></span> - 
		<span class="postdetails">{topicrow.topicadrow.FIRST_POST_TIME}</span>
	 </td>
	</tr>
	<!-- END topicadrow -->

如果觉得文字颜色、背景颜色不满意,可以自己在js代码里面修改调试。里面有一个比较重要的属性是
google_ad_height = **;
这个要自己调整,大了,会显示出其他行的内容,小了,会显示不了完整的一行字。一般以15~18之间为宜,如果是英文站点,要稍小一些。

这种MOD带有一点点欺骗的性质,如果自己的adsense帐号已经是日入斗金的,就不要这样用了,免得不小心被googlek掉帐号。

User avatar
aeou
技术组成员
技术组成员
Posts: 103
Joined: 2007-01-26 9:24

Post by aeou » 2007-04-28 7:40

似乎不错,哈哈
等俺完成网站转换,一定要尝试一下先~

newerby
论坛管理员
论坛管理员
Posts: 1293
Joined: 2006-11-10 2:20

Post by newerby » 2007-04-28 9:32

已经加上了,特地自己修改 GoogleGoogle Advertising,且设置为粗体红色,这个总该不会是欺骗了吧! Google 提供的设置技巧里还有如何融入到网页内容的。改天问问 Google 的客服这样可不可行,如果不可行还是自己撤去好了。 :wink:

Code: Select all

<font color="red"><strong>Google Advertising</strong></font>
另外:Google 如果换成 Google 广告刊登,那些汉字显示不正常,怎么解决?

期待帖子内加入广告的 MOD ,如果达不到一定的文章或者 Cash 就显示 Google Advertising 。 :D

User avatar
aodongzhi
学有小成
学有小成
Posts: 131
Joined: 2007-03-09 0:51

Post by aodongzhi » 2007-04-28 11:18

楼上,是不忘了把文件以utf-8的形式保存?

这种MOD带有一点点欺骗的性质,如果自己的adsense帐号已经是日入斗金的,就不要这样用了,免得不小心被googlek掉帐号。
我一天才几毛美金, :cry: :cry: :cry:

但是没有得到google的肯定,我还是怕怕,试用两天就删掉。

那位E文好的,帮忙问一下google。谢谢。

User avatar
aodongzhi
学有小成
学有小成
Posts: 131
Joined: 2007-03-09 0:51

Post by aodongzhi » 2007-04-28 11:20

期待帖子内加入广告的 MOD ,如果达不到一定的文章或者 Cash 就显示 Google Advertising 。
在帖子顶楼加广告,效果应该是最好的。 :lol: :lol:

期待中。

User avatar
IOsetting
论坛管理员
论坛管理员
Posts: 3647
Joined: 2006-10-17 1:48

Post by IOsetting » 2007-04-28 12:24

放在帖子頂樓的話,你把這段代碼刪掉就好了

Code: Select all

&& rand(1, 7) > 5
這個的作用是讓廣告以隨機的形式出現在帖子前排
技术问题请在相关版面直接发帖, 站内短信恕不答复

User avatar
aodongzhi
学有小成
学有小成
Posts: 131
Joined: 2007-03-09 0:51

Post by aodongzhi » 2007-04-28 15:14

我不是这个意思,我是说放在 viewtopic.php 的顶楼。

leongming
初见功力
初见功力
Posts: 81
Joined: 2007-05-02 11:06

Post by leongming » 2007-05-03 15:08

好帖````收录

User avatar
IOsetting
论坛管理员
论坛管理员
Posts: 3647
Joined: 2006-10-17 1:48

Post by IOsetting » 2007-05-11 16:35

本站Google AD已经被封, 所以建议大家不要用这个MOD了,

其实用也没关系, 只是把整个广告都显示出来就好了 --

Code: Select all

                     google_ad_width = 234;
                     google_ad_height = 16;
                     google_ad_format = "234x60_as"; 
把第二行改成60, 不过这就不叫隐藏标题了 :D

损失半年以来的十余刀广告费, 附加再不能做google ad. 可惜可惜, 还好封得早, 如果到五十几刀再封的话我就会心痛了 :(

newerby
论坛管理员
论坛管理员
Posts: 1293
Joined: 2006-11-10 2:20

Post by newerby » 2007-05-11 17:43

建议老大向 Google AdSense 申述一下,接受整改,毕竟 phpbbchina 启用这个形式的广告也就不到半个月,带来的点击也并不算多少。

User avatar
ifubo
界面组成员
界面组成员
Posts: 438
Joined: 2006-10-26 17:46

Post by ifubo » 2007-05-11 18:05

是不是被什么人恶意举报了?
还是如楼上所说,申诉一下吧
俺是一只大大大菜鸟......想要飞却怎么样也飞不高.....
支持phpbb,支持phpbbchina

User avatar
aodongzhi
学有小成
学有小成
Posts: 131
Joined: 2007-03-09 0:51

Post by aodongzhi » 2007-05-12 12:39

呵呵,我早就把高度修改成60了,怕怕。
申诉应该比较难,还是重新申请一下号吧。
不竟GG广告现在比较流行,
我当初选择phpbbxs的原因就是因为论坛的GG广告。

Locked