1.转换栏目
insert into ak_enewsclass (classid,bclassid,classname,myorder,classpath,intro,classpagekey) select id,reid,typename,sortrank,typedir,description,keywords from dede_arctype; update ak_enewsclass set tbname='news', modid='1',lencord=23; update ak_enewsclass set islist=1,listtempid=1,dtlisttempid=1,newstempid=1,classtype='.html',filetype='.html';
2.更新栏目featerclass字段
<?php require ('e/class/connect.php'); //引入数据库配置文件和公共函数文件 require ('e/class/db_sql.php'); //引入数据库操作文件 $link = db_connect(); //连接MYSQL $empire = new mysqlquery(); //声明数据库操作类 $sql = $empire ->query("select classid,bclassid from {$dbtbpre}enewsclass"); while($r = $empire ->fetch($sql)) { $featherclass = ''; if($r['bclassid']){ $featherclass .= '|' .$r['bclassid']; $sql1 = $empire ->query("select classid,bclassid from {$dbtbpre}enewsclass where classid = $r[bclassid]"); if($r1 = $empire ->fetch($sql1)){ if($r1['bclassid']){ $featherclass = '|' .$r1['bclassid'] .$featherclass; $sql2 = $empire ->query("select classid,bclassid from {$dbtbpre}enewsclass where classid = $r1[bclassid]"); if($r2 = $empire ->fetch($sql2)){ if($r2['bclassid']){ $featherclass = '|' .$r2['bclassid'] .$featherclass; $sql3 = $empire ->query("select classid,bclassid from {$dbtbpre}enewsclass where classid = $r2[bclassid]"); if($r3 = $empire ->fetch($sql3)){ if($r3['bclassid']){ $featherclass = '|' .$r3['bclassid'] .$featherclass; $sql4 = $empire ->query("select classid,bclassid from {$dbtbpre}enewsclass where classid = $r3[bclassid]"); if($r4 = $empire ->fetch($sql4)){ if($r4['bclassid']){ $featherclass = '|' .$r4['bclassid'] .$featherclass; $sql5 = $empire ->query("select classid,bclassid from {$dbtbpre}enewsclass where classid = $r4[bclassid]"); if($r5 = $empire ->fetch($sql5)){ if($r5['bclassid']){ $featherclass = '|' .$r5['bclassid'] .$featherclass; $sql6 = $empire ->query("select classid,bclassid from {$dbtbpre}enewsclass where classid = $r5[bclassid]"); if($r6 = $empire ->fetch($sql6)){ if($r6['bclassid']){ $featherclass = '|' .$r6['bclassid'] .$featherclass; } } } } } } } } } } } } $featherclass .= '|'; if($empire ->query("update {$dbtbpre}enewsclass set featherclass = '$featherclass' where classid = $r[classid]")){ echo $r['classid'] .'更新成功<br>'; }else echo $r['classid'] .'更新失败~~~~~~~~~<br>'; } } db_close(); //关闭MYSQL链接 $empire = null; //注消操作类变量 ?>
3.更新栏目sonclass字段
<?php require('e/class/connect.php'); //引入数据库配置文件和公共函数文件 require('e/class/db_sql.php'); //引入数据库操作文件 $link=db_connect(); //连接MYSQL $empire=new mysqlquery(); //声明数据库操作类 $sql=$empire->query("select classid,islast from {$dbtbpre}enewsclass"); while($r=$empire->fetch($sql)) { //echo"栏目ID:".$r['classid']; if(!$r['islast']){ $sql1=$empire->query("select classid,islast from {$dbtbpre}enewsclass where bclassid = $r[classid]"); $sonclass = ''; while($r1=$empire->fetch($sql1)){ if($r1['islast']) $sonclass = $sonclass.$r1['classid'].'|'; else{ $sql2=$empire->query("select classid,islast from {$dbtbpre}enewsclass where bclassid = $r1[classid]"); while($r2=$empire->fetch($sql2)){ if($r2['islast']) $sonclass =$sonclass.$r2['classid'].'|'; else{ $sql3=$empire->query("select classid,islast from {$dbtbpre}enewsclass where bclassid = $r2[classid]"); while($r3=$empire->fetch($sql3)){ if($r3['islast']) $sonclass =$sonclass.$r3['classid'].'|'; else{ $sql4=$empire->query("select classid,islast from {$dbtbpre}enewsclass where bclassid = $r3[classid]"); while($r4=$empire->fetch($sql4)){ if($r4['islast']) $sonclass =$sonclass.$r4['classid'].'|'; } } } } } } } //echo "<br>".'子类栏目'.'|'.$sonclass."<br>"; if($sonclass){ $sonclass = '|'.$sonclass; }else{ } if($empire->query("update {$dbtbpre}enewsclass set sonclass = '$sonclass' where classid = $r[classid]")){ echo $r['classid'].'更新成功<br>'; } else echo $r['classid'].'更新失败~~~~~~~~~<br>'; } else{ //echo ' --终极栏目'."<br>"; } } db_close(); //关闭MYSQL链接 $empire=null; //注消操作类变量 ?>
4.更新栏目lastclas字段(dede每个栏目都可添加文章,帝国只有终极栏目才可添加文章)(默认把原dede的最后一级转为终极栏目)
<?php require('e/class/connect.php'); //引入数据库配置文件和公共函数文件 require('e/class/db_sql.php'); //引入数据库操作文件 $link=db_connect(); //连接MYSQL $empire=new mysqlquery(); //声明数据库操作类 $sql=$empire->query("select classid,bclassid from {$dbtbpre}enewsclass"); $end = array(); while($r=$empire->fetch($sql)) { $sql1=$empire->query("select classid from {$dbtbpre}enewsclass where bclassid = $r[classid]"); if(!$empire->fetch($sql1)){ if($empire->query("update {$dbtbpre}enewsclass set islast=1 where classid = $r[classid]")) { echo $r['classid'].'更新成功<br>'; }else echo $r['classid'].'--------------更新失败<br>'; } } db_close(); //关闭MYSQL链接 $empire=null; //注消操作类变量 ?>
5.转换文章
insert into ak_ecms_news (id,classid,truetime,onclick,title,titlepic,filename,newstime,lastdotime,smalltext,keyboard) select id,typeid,sortrank,click,title,litpic,filename,pubdate,senddate,description,keywords from dede_archives; insert into ak_ecms_news_data_1 (id,classid,newstext,newstempid) select aid,typeid,body,1 from dede_addonarticle; insert into ak_ecms_news_index (id,classid,checked,truetime,newstime,lastdotime) select id,typeid,1,sortrank,pubdate,senddate from dede_archives;
6.栏目全部动态
update ak_enewsclass set showdt=2 ,listdt=1,nreclass=1,nreinfo=1;
7.帝国后台更新
帝国数据字典:http://www.phome.net/doc/manual/extend/html/dbdoc/index.html