备份的dede数据库备份成了sql

备份的dede数据库备份成了sql,第1张

最合适的方式:

(1)在原网站后台,备份数据库,下载到本地电脑;

(2)更换空间后,安装新程序,上传数据库到:网站根目录\data\backupdata\

(3)在新网站后台,还原数据库;

(4)更新缓存,检测数据的完整性。

这种方式,是dedecms官方推荐的,也是最安全的,一般不会出现数据遗漏。

看你要做什么站了~~

你如果你的内容很多的话~~~

MYSQL数据库也得要大点的~~

比如你有1000篇内容在网站上~~每篇占用5KB~~那么就是5000KB~~也就是5M~~

但是还有其他的内容需要占用数据库~~~

一开始使用个100M的就够用很长时间了~~~

随着内容的增加可以增加数据库的容量~~~

在新的空间重新安装dedecms,把你之前备份的sql上传到你新安装的dedecms下data文件夹下的backupdata里,然后进入后台,点击左侧的“系统”,点击"数据库备份/还原",然后点击页面右侧上方的“数据还原”,选择你要还原的数据,然后点击下方的“开始还原数据”就可以了

update `dede_addonarticle` set body=REPLACE(body,'论坛','社区') where body like "%论坛%"

以上SQL语句作用是查找所有文章带有“论坛”的词组,并将论坛替换为“社区”

给力吧 ,楼主给我加点分撒。

~id~ ~typeid~ 这边是传值用的。 列表页可以使用~typeid~ 传该列表ID 至SQL语句中,一般我用左得到TOP_ID 现在还行可以直接{dede:fieldtop_id},类似 ~id~ 是文章ID,~标识~ 这里的标识可以是文章或列表中能直接使用DEDE:{dede:field name='标识'}调用 。

<link href="{dede:globalcfg_cmsurl/}/css/detail{dede:sql sql='Select From info_arctype Where id=~typeid~}[field:topid/]{/dede:sql}css" rel="stylesheet" type="text/css" />

我有些网站有用这样调用不同栏目的CSS,具体自己可以灵活使用,看看我网站效果吧。http://wwwymmzbcom/

我们可以另外嵌入一个类似{dede:listsql sql='select from wp_posts' pagesize='10'}的标签来使用。

OK,思路已经有了,接下来我们打开include/arclistviewclassphp这个文件来给它动个小手术吧!

找到:

if(!is_object($ctag)) { $ctag = $this->dtp->GetTag("list"); }

这一段,在其后添加如下代码

if(!is_object($ctag)) { $ctag = $this->dtp->GetTag("listsql"); if (is_object($ctag)) { $cquery = $ctag->GetAtt("sql"); $cquery = preg_replace("/SELECT()FROM/is", " SELECT count() as dd FROM ", $cquery); $cquery = preg_replace("/ORDER()SC/is", "", $cquery); $row = $this->dsql->GetOne($cquery); if(is_array($row)) { $this->TotalResult = $row['dd']; } else { $this->TotalResult = 0; } } } //end

然后找到:

if($ctag->GetName()=="list") { $limitstart = ($this->PageNo-1) $this->PageSize; $row = $this->PageSize; if(trim($ctag->GetInnerText())=="") { $InnerText = GetSysTemplets("list_fulllisthtm"); } else { $InnerText = trim($ctag->GetInnerText()); } $this->dtp->Assign($tagid, $this->GetArcList( $limitstart, $row, $ctag->GetAtt("col"), $ctag->GetAtt("titlelen"), $ctag->GetAtt("infolen"), $ctag->GetAtt("imgwidth"), $ctag->GetAtt("imgheight"), $ctag->GetAtt("listtype"), $ctag->GetAtt("orderby"), $InnerText, $ctag->GetAtt("tablewidth"), $ismake, $ctag->GetAtt("orderway") ) ); }

这一段,在其后添加如下代码:

else if($ctag->GetName()=="listsql") { $limitstart = ($this->PageNo-1) $this->PageSize; $row = $this->PageSize; if(trim($ctag->GetInnerText())=="") { $InnerText = GetSysTemplets("list_fulllisthtm"); } else { $InnerText = trim($ctag->GetInnerText()); } $this->dtp->Assign($tagid, $this->GetSqlList( $limitstart, $row, $ctag->GetAtt("sql"), $InnerText ) ); } //end

最后找到function GetArcList这个方法,在其后添加一个可以通过传入sql参数获取指定数据源的方法,代码如下:

/ 通过listsql标签中sql属性传入的参数来获得一个单列的文档列表 / function GetSqlList($limitstart = 0, $row = 10, $sql = '', $innertext){ global $cfg_list_son; $innertext = trim($innertext); if ($innertext == '') { $innertext = GetSysTemplets('list_fulllisthtm'); } //处理SQL语句 $limitStr = " LIMIT {$limitstart},{$row}"; $this->dsql->SetQuery($sql $limitStr); $this->dsql->Execute('al'); $t2 = ExecTime(); //echo $t2-$t1; $sqllist = ''; $this->dtp2->LoadSource($innertext); $GLOBALS['autoindex'] = 0; //获取字段 while($row = $this->dsql->GetArray("al")) { $GLOBALS['autoindex']++; if(is_array($this->dtp2->CTags)) { foreach($this->dtp2->CTags as $k=>$ctag) { if($ctag->GetName()=='array') { //传递整个数组,在runphp模式中有特殊作用 $this->dtp2->Assign($k,$row); } else { if(isset($row[$ctag->GetName()])) { $this->dtp2->Assign($k,$row[$ctag->GetName()]); } else { $this->dtp2->Assign($k,''); } } } } $sqllist = $this->dtp2->GetResult(); }//while $t3 = ExecTime(); //echo ($t3-$t2); $this->dsql->FreeResult('al'); return $sqllist; } //end

总共就添加三段代码,每一段代码基本都参考它紧接着的上面那段原始代码,而无需改变它原来任何一个地方的代码,应该算是比较完美的手术了,接下来在模板文件中的使用方法就跟一开始思路中所提到的那样,分页标签依旧沿用原来的,调用范例:

{dede:listsql sql='select ID,post_title from wp_posts' pagesize='10'} <li><a href="http://ys21426blog163com/[field:ID /]html">[field:post_title /]</a></li> {/dede:listsql} <!--分页--> {dede:pagelist listsize='2' listitem='index pre pageno next end '/}

直接写sql语句像你这样也可以

sql='Select from dede_dede_archives arc left join dede_addoninfos addon on addodaid= arcid where arcflag='c' "

也可以用arclist标签调用

{arclist channel="模型号" addfields="需要附加表的字段名,用,间隔" flag="c"}

$dsql->SetQuery("Select  aaid,atypeid,aimg_up,aimg_link,bid,bchannel,btypeid  From  dede_addonarticle a LEFT JOIN   dede_archives  b on btypeid=atypeid  where bchannel=17 and atypeid=14  order by bid desc limit 0,5");

试试吧

DABAN RP主题是一个优秀的主题,极致后台体验,无插件,集成会员系统
网站模板库 » 备份的dede数据库备份成了sql

0条评论

发表评论

提供最优质的资源集合

立即查看 了解详情