Discuz!5.5 6.0会员发帖可以显示自己Google AdSense广告功能代码

[复制链接]
查看: 1157   回复: 0
发表于 2007-8-12 06:51:41 | 显示全部楼层 |阅读模式
论坛版本:Discuz! 6.0RC1  
演示地址:http://www.neter8.com
具体方法:
本次升级到6.0具有很大的调整 和以住流传到网络的有所不同,以前是利用MSN改 现在我用的是ICQ改 在技术上有所突破,不过本人不会写程序 还请高手把随机显示的代码的写出来,本程序由本人原创,灵感来自广告发布者论坛,改这个的初忠是给自己用,有很多朋友要求发出来所以就公布开了,目前没有发现BUG 只是随机显示本人还没有掌握。

第一步:升级数据库:

[Copy to clipboard] [ - ]
CODE:
ALTER TABLE `cdb_memberfields` CHANGE `icq` `icq` VARCHAR( 16 ) CHARACTER SET gbk COLLATE gbk_chinese_ci NOT NULL


注意我的是GBK版的 你看升级代码就知道  还有 表头是CDB开头的 请根据你的论坛修改这行代码。
第二步:修改templates\default\memcp_profile.htm 这个文件。
查找:

[Copy to clipboard] [ - ]
CODE:
<tr>
        <th><label for="icqnew">icq</label></th>
        <td><input type="text" name="icqnew" id="icqnew" size="25" value="$member[icq]" /></td>
        </tr>


替换为:

[Copy to clipboard] [ - ]
CODE:
<tr>
        <th><label for="icqnew">Google Adsense: Pub-</label></th>
        <td><input type="text" name="icqnew" id="icqnew" size="25" value="$member[icq]" /></td>
        </tr>


修改论坛目录下的memcp.php
查找:

[Copy to clipboard] [ - ]
CODE:
$icqnew = preg_match ("/^([0-9]+)$/", $icqnew) && strlen($icqnew) >= 5 && strlen($icqnew) <= 12 ? $icqnew : '';


替换为:

[Copy to clipboard] [ - ]
CODE:
$icqnew = preg_match ("/^([0-9]+)$/", $icqnew) && strlen($icqnew) == 16 ? $icqnew : '';


修改:templates\default\viewthread.htm
查找:

[Copy to clipboard] [ - ]
CODE:
<h2>$post[subject]</h2>

                                                <!--{/if}-->


下面加

[Copy to clipboard] [ - ]
CODE:
<!--贴内右侧广告开始-->

<!--{if $post['count'] < 2 }-->
        <div align="right">
<table border="0" align="right" width="250">
                     <tr>
<td>
<script type="text/javascript"><!--
<!--{if $post['icq']}-->
google_ad_client = "pub-$post[icq]";
<!--{else}-->
google_ad_client = "pub-1122334455667788";
<!--{/if}-->
google_ad_width = 200;
google_ad_height = 200;
google_ad_format = "200x200_as";
google_ad_type = "text";
google_ad_channel = "";
//--></script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</td>
                    </tr>
                </table>
        </div><!--{/if}-->

<!--贴内右侧广告结束 -->


更新缓存 OK
这是插件方法 使用说明:
http://www.neter8.com/thread-122-1-1.html
原帖地址:
http://www.neter8.com/forum-16-1.html

原载请注明出处:网络人站长论坛发布

PS:
本人不会写程序,我们在帖人实现随机显示 请高手帮我改一下:

[Copy to clipboard] [ - ]
CODE:
<!--贴内右侧广告开始-->

<!--{if $post['count'] < 2 }-->
        <div align="right">
<table border="0" align="right" width="250">
                     <tr>
<td>
<script type="text/javascript"><!--
<!--{if $post['icq']}-->
google_ad_client = "pub-$post[icq]";
<!--{else}-->
google_ad_client = "pub-1122334455667788";
<!--{/if}-->
google_ad_width = 200;
google_ad_height = 200;
google_ad_format = "200x200_as";
google_ad_type = "text";
google_ad_channel = "";
//--></script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</td>
                    </tr>
                </table>
        </div><!--{/if}-->

<!--贴内右侧广告结束 -->


把代码显示方式改成随机 :lol
好了 大家多多支持我的站长论坛 刚才建设不久 我一直在努力 。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则