别人复制自己网站的文章,按照常理,我们是很乐意的,但是个人人转载我们文章却没有注明来源哪里,弄得自己辛辛苦苦的果实就丢失了…..
其实实现复制网站文章自动加版权很简单,asp,php语言都实践成功!
先来说说discuz论坛如何实现,(注意以下代码全部修改为你自己的差数!)
找到你当前使用的模板,默认位置wwwroot/templates/default
修改header.htm,在<body onkeydown=”if(event.keyCode==27) return false;”> 下面加入以下代码:
<script type=”text/javascript”>
document.body.oncopy = function () {
setTimeout( function () {
var text = clipboardData.getData(”text”);
if (text) {
text = text + “\r\n本文来自:上网本论坛_CoolTouch[http://www.noteben.com] 详细出处请参考:”+location.href; clipboardData.setData(”text”, text);
}
}, 100 )
}
</script>
wp文章版权设置:
如果你网站需要每个角落都实现复制自动加版权的话,在当前主题foot.php加入:
<script type=”text/javascript”>
document.body.oncopy = function () {
setTimeout( function () {
var text = clipboardData.getData(”text”);
if (text) {
text = text + “\r\n本文来自: 自由,自由生活_自由幻想(http://41free.com) 详细出处请随意参考:”+location.href; clipboardData.setData(”text”, text);
}
}, 100 )
}
</script>
如果你只需要在文章页面实现的话,则在single.php合适的位置添加以上代码即可.
然后蓝色安防是一个asp做的站,其实也很简单,找到foot.asp加入下面代码:
<script type=”text/javascript”>
document.body.oncopy = function () {
setTimeout( function () {
var text = clipboardData.getData(”text”);
if (text) {
text = text + “\r\n本文来自: 蓝色光芒_信息安全 [www.lansk.cn] 详细出处参考:”+location.href; clipboardData.setData(”text”, text);
}
}, 100 )
}
</script>
具体效果可以查看本站,或者在上述案例站点查看
本文关键字: Discuz优化, Discuz加文章版权, 复制文章自动加版权