使用DedeCMS建站會遇到這樣的問題,采集來的文章有個小錯誤沒修正,需要把文章的內(nèi)容批量替換下,一篇一篇的修改會十分麻煩,這里就需要用到織夢的特有功能,SQL批量替換功能,語法標(biāo)簽如下:
1.更改文章中的內(nèi)容
update dede_addonarticle set body=replace(body,'原來的字符','替換后的字符')
例子解釋:update dede_addonarticle set body=replace(body,'軟件下載','插件下載')
2.更改縮略圖目錄
update dede_archives set litpic=replace(litpic,'原來的字符','替換后的字符')
例子解釋:update dede_archives set litpic=replace(litpic,'uplimg,'tupian')
3.批量替換文章模型中內(nèi)容部分圖片鏈接路徑
update dede_addonarticle set body=replace(body,'src="http://xiuzhanwang.com/img/','src="http://xiuzhanwang.com/images/');
例子解釋:把圖片路徑由原來的http://www.xiuzhanwang.com/img/替換成http://xiuzhanwang.com/images/
4.批量替換文章模型中內(nèi)容部分超鏈接
update dede_addonarticle set body=replace(body,'href="http://www.xiuzhanwang.com','href="http://xiuzhanwang.com');
例子解釋:把文章模型中的超鏈接由原來的http://www.xiuzhanwang.com替換成http://xiuzhanwang.com
5.批量替換文章模型中內(nèi)容部分圖片錨文本文字
update dede_addonarticle set body=replace(body,'alt="麥站','alt="織夢模板');
例子解釋:把文章模型中的圖片錨文本信息由原來的麥站替換成織夢模板
6.批量替換軟件模型內(nèi)容部分超鏈接
update dede_addonsoft set introduce=replace(introduce,'href="http://www.xiuzhanwang.com/images/js/test.html','href="http:/xiuzhanwang.com/index.html');
例子解釋:把軟件模型內(nèi)容中超鏈接由原來的http://www.xiuzhanwang.com/images/js/test.html替換成http:/xiuzhanwang.com/index.htm
7.批量替換文章模型中作者字段
update dede_archives set writer=replace(writer,'http://www.xiuzhanwang.com','http://xiuzhanwang.com');
例子解釋:把文章模型中的作者由原來的http://www.xiuzhanwang.com替換成http://xiuzhanwang.com
8.批量替換文章模型中來源字段
update dede_archives set source=replace(source,'麥站','織夢模板');;
例子解釋:把文章模型中的帖子來源由原來的麥站替換成織夢模板
9.批量替換文章命名規(guī)則
update `dede_arctype` set namerule='{typedir}/{aid}.html';
例子解釋:把站內(nèi)所有文章模型命名規(guī)則全部替換成{typedir}/{aid}.html這樣一種形式
10.批量替換軟件模型演示地址超鏈接
update dede_addonsoft set writer=replace(officialUrl,'http:/www.xiuzhanwang.com','http://xiuzhanwang.com');
例子解釋:把軟件模型原始地址超鏈接由原來的http:/www.xiuzhanwang.com替換成http://xiuzhanwang.com
11.批量審核文章
update dede_archives set arcrank=0;
例子解釋:arcrank=0 僅動態(tài)。