GVKun编程网logo

织梦CMS实现复制新闻自动加出处信息(织梦自动采集发布)

5

关于织梦CMS实现复制新闻自动加出处信息和织梦自动采集发布的问题就给大家分享到这里,感谢你花时间阅读本站内容,更多关于dedecms织梦网站优化内部链接教程:给新闻自动添加Keywords锚文本、de

关于织梦CMS实现复制新闻自动加出处信息织梦自动采集发布的问题就给大家分享到这里,感谢你花时间阅读本站内容,更多关于dedecms织梦网站优化内部链接教程:给新闻自动添加Keywords锚文本、dede怎么实现别人复制新闻自动加上网站版权信息、PHPCMS 解决word复制新闻分页错误、摘自织梦CMS中的图片处理类,摘自织梦cms图片等相关知识的信息别忘了在本站进行查找喔。

本文目录一览:

织梦CMS实现复制新闻自动加出处信息(织梦自动采集发布)

织梦CMS实现复制新闻自动加出处信息(织梦自动采集发布)

 

假如发现自己辛苦创作的很多新闻被别人复制或者采集而去,一个链接都不留下,你是不是会很气愤、很郁闷呢?不过好在我们还有一些基本保护举措可以减小损失, 那就是用javascript实现对新闻原创作者的基本版权保护,在复制或者是采集时将自动加上新闻的出处带上,其实实现这个功能的代码特别简单,只需要在内容详细页源码(article_*.htm)中的<body></body>区域内加入一下代码即可:

<script type="text/javascript"> document.body.oncopy = function (){ setTimeout(function (){ var text = clipboardData.getData("text"); if (text){ texttext = text + "rn本文转载于{dede:global.cfg_webname/}:{dede:global.cfg_basehost/}-原文链接:"+location.href; clipboardData.setData("text", text); } },100) } </script>  

好了,赶快试试吧!

本文章网址:http://www.ppssdd.com/code/14191.html。转载请保留出处,谢谢合作!

dedecms织梦网站优化内部链接教程:给新闻自动添加Keywords锚文本

dedecms织梦网站优化内部链接教程:给新闻自动添加Keywords锚文本

 

解决问题:dedecms织梦内部链接教程:怎么给新闻自动添加Keywords内部链接锚文本 。
 

网站Keywords内部链接,是做好网站内部优化的一个重要环节,织梦(DedeCMS)官方默认规则是:
 

1.添加Keywords和Keywords的链接地址

  设置步骤:进入后台 核心->批量维护->文档Keywords维护

2.新闻内容出现该Keywords

3.新闻的Keywords出现这个词(就是这里 ) //这个是在发布新闻的时候填写的

  第三条规则使得Keywords内部链接不尽完美,所以得修改文件取消掉第三条规则,达到我们想要的效果,即新闻内出现该Keywords即链向指定的网址,在Dedecms5.5,5.6下测试有效。

一、开打include/arc.archives.class.php 文件

二、查找 function ReplaceKeyword($kw,&$body)

三、往下找到下面这段代码,删除或注释掉( 做网站)


foreach($kws as $k){$k = trim($k); if($k!=""){if($i > $maxkey){break;} $myrow = $this->dsql->GetOne("select * from meiwen_keywords where keyword='$k' And rpurl<>'' "); if(is_array($myrow)) { $karr[] = $k; $GLOBALS['replaced'][$k] = 0; $kaarr[] = "<span>$k</span>"; } $i++;}}  

四、并在注释或删除的代码下面加入以下代码:


$dsql = new DedeSql(false); $query="select * from meiwen_keywords where rpurl<>'' "; $dsql->SetQuery($query);$dsql->Execute(); while($row = $dsql->GetArray()) {$key = trim($row['keyword']); $rul=trim($row['rpurl']); if($rul!="")if(!in_array($key, $kw))if(!in_array($kw,$key))if(substr_count($body,$key)<20){$karr[] = $key;$kaarr[] = "$key";}}  

五、OK,已经修改完成了。直接复制上面代码,新闻内同样的Keywords只会出现一个链接。

六、一键更新网站->更新所有 。

本文章网址:http://www.ppssdd.com/code/23424.html。转载请保留出处,谢谢合作!

dede怎么实现别人复制新闻自动加上网站版权信息

dede怎么实现别人复制新闻自动加上网站版权信息

 

如果经常手动复制别人网站新闻的网友,会遇到复制别人的新闻,然后再粘贴,新闻后面就会加上目标网站的URL等信息,那这个功能是如何回事?我们需要怎么防止别人采集我们的网站呢。现在就已dede仿站教程网为大家举例。dedecms能不能实现?其实也是很简单的,代码如下:

 

document.body.oncopy = function () { setTimeout( function () { var text = clipboardData.getData("text"); if (text) { text = text + "\r\n本篇新闻来源于 原文链接:"+location.href; clipboardData.setData("text", text); } }, 100 ) }

 

只要把上面的代码放到你的内容dede模版的新闻正文的下面 (就是这个{dede:field.body/}标签后面即可) 。你要修改的就是把dede标签里面红色标记起来的URL改成你的URL就可以了,很简单吧。

本文章网址:http://www.ppssdd.com/code/20993.html。转载请保留出处,谢谢合作!

PHPCMS 解决word复制新闻分页错误

PHPCMS 解决word复制新闻分页错误

PHPCMS中造成word复制的新闻分页错误的原因是<div>错误,导致部分页面网页布局错误临时想到的办法是修改了一下fck_paste.html文件

修改方法是
查找“return html ;”
在其上面添加如下代码

html = html.replace( /<span>/gi,'''' ) ;

html = html.replace( /</span>/gi,'''' ) ;

html = html.replace( /<div>/gi,'''' ) ;

html = html.replace( /</div>/gi,''<br />'' ) ; 

这是临时的方法,不知道大家有没有好的想法吗

总结

以上是小编为你收集整理的PHPCMS 解决word复制新闻分页错误全部内容。

如果觉得小编网站内容还不错,欢迎将小编网站推荐给好友。

摘自织梦CMS中的图片处理类,摘自织梦cms图片

摘自织梦CMS中的图片处理类,摘自织梦cms图片

摘自织梦cms中的图片处理类,摘自织梦cms图片

本文实例讲述了摘自织梦cms中的图片处理类。分享给大家供大家参考。具体如下:

<&#63;php if(!defined(''DEDEINC'')) exit(''dedecms'');
/**
 * 图像处理类
 *
 * @version  $Id: image.class.php 1 18:10 2010年7月5日Z tianya $
 * @package  DedeCMS.Libraries
 * @copyright  Copyright (c) 2007 - 2010, DesDev, Inc.
 * @license  http://help.dedecms.com/usersguide/license.html
 * @link   http://www.dedecms.com
 */
class image
{
 var $attachinfo;
 var $targetfile; //图片路径
 var $imagecreatefromfunc;
 var $imagefunc;
 var $attach;
 var $animatedgif;
 var $watermarkquality;
 var $watermarktext;
 var $thumbstatus;
 var $watermarkstatus;
 // 析构函数,兼容PHP4
 function image($targetfile, $cfg_thumb, $cfg_watermarktext, $photo_waterpos, $photo_diaphaneity, $photo_wheight, $photo_wwidth, $cfg_watermarktype, $photo_marktrans,$trueMarkimg, $attach = array())
 {
  $this->__construct($targetfile, $cfg_thumb, $cfg_watermarktext, $photo_waterpos, $photo_diaphaneity, $photo_wheight, $photo_wwidth, $cfg_watermarktype, $photo_marktrans,$trueMarkimg, $attach);
 }
 // 析构函数
 function __construct($targetfile, $cfg_thumb, $cfg_watermarktext, $photo_waterpos, $photo_diaphaneity, $photo_wheight, $photo_wwidth, $cfg_watermarktype, $photo_marktrans,$trueMarkimg, $attach = array())
 {
  $this->thumbstatus = $cfg_thumb;
  $this->watermarktext = $cfg_watermarktext;
  $this->watermarkstatus = $photo_waterpos;
  $this->watermarkquality = $photo_marktrans;
  $this->watermarkminwidth = $photo_wwidth;
  $this->watermarkminheight = $photo_wheight;
  $this->watermarktype = $cfg_watermarktype;
  $this->watermarktrans = $photo_diaphaneity;
  $this->animatedgif = 0;
  $this->targetfile = $targetfile;
  $this->attachinfo = @getimagesize($targetfile);
  $this->attach = $attach;
  switch($this->attachinfo[''mime''])
  {
   case ''image/jpeg'':
    $this->imagecreatefromfunc = function_exists(''imagecreatefromjpeg'') &#63; ''imagecreatefromjpeg'' : '''';
    $this->imagefunc = function_exists(''imagejpeg'') &#63; ''imagejpeg'' : '''';
    break;
   case ''image/gif'':
    $this->imagecreatefromfunc = function_exists(''imagecreatefromgif'') &#63; ''imagecreatefromgif'' : '''';
    $this->imagefunc = function_exists(''imagegif'') &#63; ''imagegif'' : '''';
    break;
   case ''image/png'':
    $this->imagecreatefromfunc = function_exists(''imagecreatefrompng'') &#63; ''imagecreatefrompng'' : '''';
    $this->imagefunc = function_exists(''imagepng'') &#63; ''imagepng'' : '''';
    break;
  }//为空则匹配类型的函数不存在
  $this->attach[''size''] = empty($this->attach[''size'']) &#63; @filesize($targetfile) : $this->attach[''size''];
  if($this->attachinfo[''mime''] == ''image/gif'')
  {
   $fp = fopen($targetfile, ''rb'');
   $targetfilecontent = fread($fp, $this->attach[''size'']);
   fclose($fp);
   $this->animatedgif = strpos($targetfilecontent, ''NETSCAPE2.0'') === false &#63; 0 : 1;
  }
 }
 /**
  * 生成缩略图
  *
  * @access public
  * @param  int $thumbwidth 图片宽度
  * @param  int $thumbheight 图片高度
  * @param  int $preview 是否预览
  * @return void
  */
 function thumb($thumbwidth, $thumbheight, $preview = 0)
 {
  $this->thumb_gd($thumbwidth, $thumbheight, $preview);
 
  if($this->thumbstatus == 2 && $this->watermarkstatus)
  {
   $this->image($this->targetfile, $this->attach);
   $this->attach[''size''] = filesize($this->targetfile);
  }
 }
 /**
  * 图片水印
  *
  * @access public
  * @param  int $preview 是否预览
  * @return void
  */
 function watermark($preview = 0)
 {
  if($this->watermarkminwidth && $this->attachinfo[0] <= $this->watermarkminwidth && $this->watermarkminheight && $this->attachinfo[1] <= $this->watermarkminheight)
  {
   return ;
  }
  $this->watermark_gd($preview);
 }
 /**
  * 使用gd生成缩略图
  *
  * @access public
  * @param  int $thumbwidth 图片宽度
  * @param  int $thumbheight 图片高度
  * @param  int $preview 是否预览
  * @return void
  */
 function thumb_gd($thumbwidth, $thumbheight, $preview = 0)
 {
  if($this->thumbstatus && function_exists(''imagecreatetruecolor'') && function_exists(''imagecopyresampled'') && function_exists(''imagejpeg''))
  {
   $imagecreatefromfunc = $this->imagecreatefromfunc;
   $imagefunc = $this->thumbstatus == 1 &#63; ''imagejpeg'' : $this->imagefunc;
   list($imagewidth, $imageheight) = $this->attachinfo;
   if(!$this->animatedgif && ($imagewidth >= $thumbwidth || $imageheight >= $thumbheight))
   {
    $attach_photo = $imagecreatefromfunc($this->targetfile);
    $x_ratio = $thumbwidth / $imagewidth;
    $y_ratio = $thumbheight / $imageheight;
    if(($x_ratio * $imageheight) < $thumbheight)
    {
     $thumb[''height''] = ceil($x_ratio * $imageheight);
     $thumb[''width''] = $thumbwidth;
    }
    else
    {
     $thumb[''width''] = ceil($y_ratio * $imagewidth);
     $thumb[''height''] = $thumbheight;
    }
    $targetfile = !$preview &#63; ($this->thumbstatus == 1 &#63; $this->targetfile.''.thumb.jpg'' : $this->targetfile) : ''./watermark_tmp.jpg'';
    $thumb_photo = imagecreatetruecolor($thumb[''width''], $thumb[''height'']);
    imagecopyresampled($thumb_photo, $attach_photo, 0, 0, 0, 0, $thumb[''width''], $thumb[''height''], $imagewidth, $imageheight);
    if($this->attachinfo[''mime''] == ''image/jpeg'')
    {
     $imagefunc($thumb_photo, $targetfile, 100);
    }
    else
    {
     $imagefunc($thumb_photo, $targetfile);
    }
    $this->attach[''thumb''] = $this->thumbstatus == 1 &#63; 1 : 0;
   }
  }
 }
 /**
  * 使用gd进行水印
  *
  * @access public
  * @param  int $preview 是否预览
  * @return void
  */
 function watermark_gd($preview = 0)
 {
  if($this->watermarkstatus && function_exists(''imagecopy'') && function_exists(''imagealphablending'') && function_exists(''imagecopymerge''))
  {
   $imagecreatefunc = $this->imagecreatefromfunc;
   $imagefunc = $this->imagefunc;
   list($imagewidth, $imageheight) = $this->attachinfo;
   if($this->watermarktype < 2)
   {
    $watermark_file = $this->watermarktype == 1 &#63; DEDEDATA.''/mark/mark.png'' : DEDEDATA.''/mark/mark.gif'';
    $watermarkinfo = @getimagesize($watermark_file);
    $watermark_logo = $this->watermarktype == 1 &#63; @imagecreatefrompng($watermark_file) : @imagecreatefromgif($watermark_file);
    if(!$watermark_logo)
    {
     return ;
    }
    list($logowidth, $logoheight) = $watermarkinfo;
   }
   else
   {
    $box = @imagettfbbox($this->watermarktext[''size''], $this->watermarktext[''angle''], $this->watermarktext[''fontpath''],$this->watermarktext[''text'']);
    $logowidth = max($box[2], $box[4]) - min($box[0], $box[6]);
    $logoheight = max($box[1], $box[3]) - min($box[5], $box[7]);
    $ax = min($box[0], $box[6]) * -1;
    $ay = min($box[5], $box[7]) * -1;
   }
   $wmwidth = $imagewidth - $logowidth;
   $wmheight = $imageheight - $logoheight;
   if(($this->watermarktype < 2 && is_readable($watermark_file) || $this->watermarktype == 2) && $wmwidth > 10 && $wmheight > 10 && !$this->animatedgif)
   {
    switch($this->watermarkstatus)
    {
     case 1:
 
      $x = +5;
      $y = +5;
      break;
     case 2:
      $x = ($imagewidth - $logowidth) / 2;
      $y = +5;
      break;
     case 3:
      $x = $imagewidth - $logowidth - 5;
      $y = +5;
      break;
     case 4:
      $x = +5;
      $y = ($imageheight - $logoheight) / 2;
      break;
     case 5:
      $x = ($imagewidth - $logowidth) / 2;
      $y = ($imageheight - $logoheight) / 2;
      break;
     case 6:
      $x = $imagewidth - $logowidth - 5;
      $y = ($imageheight - $logoheight) / 2;
      break;
     case 7:
      $x = +5;
      $y = $imageheight - $logoheight - 5;
      break;
     case 8:
      $x = ($imagewidth - $logowidth) / 2;
      $y = $imageheight - $logoheight - 5;
      break;
     case 9:
      $x = $imagewidth - $logowidth - 5;
      $y = $imageheight - $logoheight -5;
      break;
    }
    $dst_photo = @imagecreatetruecolor($imagewidth, $imageheight);
    $target_photo = $imagecreatefunc($this->targetfile);
    imagecopy($dst_photo, $target_photo, 0, 0, 0, 0, $imagewidth, $imageheight);
    if($this->watermarktype == 1)
    {
     imagecopy($dst_photo, $watermark_logo, $x, $y, 0, 0, $logowidth, $logoheight);
    }
    elseif($this->watermarktype == 2)
    {
     if(($this->watermarktext[''shadowx''] || $this->watermarktext[''shadowy'']) && $this->watermarktext[''shadowcolor''])
     {
      $shadowcolorrgb = explode('','', $this->watermarktext[''shadowcolor'']);
      $shadowcolor = imagecolorallocate($dst_photo, $shadowcolorrgb[0], $shadowcolorrgb[1], $shadowcolorrgb[2]);
      imagettftext($dst_photo, $this->watermarktext[''size''], $this->watermarktext[''angle''],
      $x + $ax + $this->watermarktext[''shadowx''], $y + $ay + $this->watermarktext[''shadowy''], $shadowcolor,
      $this->watermarktext[''fontpath''], $this->watermarktext[''text'']);
     }
     $colorrgb = explode('','', $this->watermarktext[''color'']);
     $color = imagecolorallocate($dst_photo, $colorrgb[0], $colorrgb[1], $colorrgb[2]);
     imagettftext($dst_photo, $this->watermarktext[''size''], $this->watermarktext[''angle''],
     $x + $ax, $y + $ay, $color, $this->watermarktext[''fontpath''], $this->watermarktext[''text'']);
    }
    else
    {
     imagealphablending($watermark_logo, true);
     imagecopymerge($dst_photo, $watermark_logo, $x, $y, 0, 0, $logowidth, $logoheight, $this->watermarktrans);
    }
    $targetfile = !$preview &#63; $this->targetfile : ''./watermark_tmp.jpg'';
    if($this->attachinfo[''mime''] == ''image/jpeg'')
    {
     $imagefunc($dst_photo, $targetfile, $this->watermarkquality);
    }
    else
    {
     $imagefunc($dst_photo, $targetfile);
    }
    $this->attach[''size''] = filesize($this->targetfile);
   }
  }
 }
}//End Class

登录后复制

希望本文所述对大家的php程序设计有所帮助。

关于织梦CMS实现复制新闻自动加出处信息织梦自动采集发布的问题就给大家分享到这里,感谢你花时间阅读本站内容,更多关于dedecms织梦网站优化内部链接教程:给新闻自动添加Keywords锚文本、dede怎么实现别人复制新闻自动加上网站版权信息、PHPCMS 解决word复制新闻分页错误、摘自织梦CMS中的图片处理类,摘自织梦cms图片等相关知识的信息别忘了在本站进行查找喔。

本文标签: