在數(shù)據(jù)無縫對(duì)接且UR不變的情況下WordPress網(wǎng)站轉(zhuǎn)開源yzmcms
[重要通告]如您遇疑難雜癥,本站支持知識(shí)付費(fèi)業(yè)務(wù),掃右邊二維碼加博主微信,可節(jié)省您寶貴時(shí)間哦!
一個(gè)網(wǎng)站的源碼用久了可能就不愿意更換,也可能有其他原因就會(huì)更換,就比如前幾天的dedecms收費(fèi),站內(nèi)還寫了關(guān)于dedecms轉(zhuǎn)yzmcms
織夢(mèng)Dedecms站點(diǎn)轉(zhuǎn)開源內(nèi)容管理系統(tǒng)YzmCMS教程(含插件下載)
當(dāng)我們的網(wǎng)站原來是用wordpress做的現(xiàn)在想轉(zhuǎn)用yzmcms程序,就需要將模板和數(shù)據(jù)都轉(zhuǎn)到y(tǒng)zmcms并且保持原來的鏈接URL不能變,至于模板是比較簡(jiǎn)單的,瀏覽器另存為html文件再對(duì)照官方標(biāo)簽文檔套用即可,這里推薦yzmcms模板標(biāo)簽助手(? ? YzmCMS內(nèi)容管理系統(tǒng)模板標(biāo)簽助手? ? )但是數(shù)據(jù)庫要轉(zhuǎn)移至yzmcms這時(shí)該怎么辦呢,老梁分享一下wordpress網(wǎng)站數(shù)據(jù)庫無縫轉(zhuǎn)移至yzmcms,話不多說,直接上代碼:
/**插入基礎(chǔ)表信息**/ insert into yzm_article (id,catid,userid,username,nickname,title,seo_title,inputtime,updatetime,keywords,description,click,content,copyfrom,thumb,articledir,url,flag,status,system ,listorder,groupids_view,readpoint ) select ID,0,post_author,”,”,post_title,post_title,unix_timestamp(post_date),unix_timestamp(post_modified),”,”,0,post_content,”,”,”,guid,”,1,1,10,0,0 from wp_posts where post_parent=0 and post_type=‘post’ and (post_status=‘publish’ or post_status=‘draft’ or post_status=‘a(chǎn)uto-draft’) /**將文章的縮略圖信息進(jìn)行修改**/ update yzm_article y inner join (select s.guid,s.post_parent,a.post_id,a.meta_value from wp_posts s,wp_postmeta a where meta_key=‘_thumbnail_id’ and a.meta_value=s.ID ) c on y.id =c.post_id set y.thumb = c.guid /**將文章的摘要信息進(jìn)行修改**/ update yzm_article y inner join (select s.guid,s.post_parent,a.post_id,a.meta_value from wp_posts s,wp_postmeta a where meta_key=‘zhaiyao_value’ and a.post_id=s.ID ) c on y.id =c.post_id set y.description = c.meta_value /**將文章的閱讀數(shù)進(jìn)行修改**/ update yzm_article y inner join (select s.guid,s.post_parent,a.post_id,a.meta_value from wp_posts s,wp_postmeta a where meta_key=‘views’ and a.post_id=s.ID ) c on y.id =c.post_id set y.click = c.meta_value /**將文章的來源信息進(jìn)行修改**/ update yzm_article y inner join (select s.guid,s.post_parent,a.post_id,a.meta_value from wp_posts s,wp_postmeta a where meta_key=‘laiyuan_value’ and a.post_id=s.ID ) c on y.id =c.post_id set y.copyfrom = c.meta_value /**添加分類**/ insert yzm_category(catid,catname,catdir,mobname,category_template ,list_template ,show_template, arrchildid, modelid ) select s.term_id,s.name,s.slug,s.name,‘category_page’,‘list_article’,‘show_article’,s.term_id,1 from wp_terms s,wp_term_taxonomy y where y.taxonomy=‘category’ and y.term_id = s.term_id /**操作分類和文章的關(guān)系**/ update yzm_article y inner join ( select object_id,a.term_taxonomy_id,b.taxonomy from wp_term_relationships a,wp_term_taxonomy b where a.term_taxonomy_id=b.term_id and taxonomy=‘category’) c on y.id =c.object_id set y.catid = c.term_taxonomy_id /**操作標(biāo)簽**/ insert yzm_tag (id,tag,total,inputtime) select a.term_id,b.`name`,a.count,1551964444 from wp_term_taxonomy a,wp_terms b WHERE a.term_id=b.term_id and a.taxonomy=‘post_tag’; /**操作標(biāo)簽和文章的關(guān)系**/ insert yzm_tag_content (modelid,aid,tagid,catid) select 1,object_id,term_taxonomy_id,b.catid from wp_term_relationships a,yzm_article b where a.object_id=b.id
以上是文章、分類、標(biāo)簽tag、縮略圖等包含網(wǎng)站大部分?jǐn)?shù)據(jù)了。
先將wordress網(wǎng)站的數(shù)據(jù)庫中的以下數(shù)據(jù)表導(dǎo)出.sql文件,
然后,分別將這些.sql導(dǎo)入至yzmcms程序的數(shù)據(jù)庫中,最后再用上面的代碼分別執(zhí)行一次,這樣進(jìn)入yzmcms程序的后臺(tái)再看數(shù)據(jù)就會(huì)發(fā)現(xiàn)數(shù)據(jù)已經(jīng)全部轉(zhuǎn)過來了,最后系統(tǒng)設(shè)置里填寫好域名,再批量更新URL,至此,wordpress數(shù)據(jù)就全部成功轉(zhuǎn)移至yzmcms了。
問題未解決?付費(fèi)解決問題加Q或微信 2589053300 (即Q號(hào)又微信號(hào))右上方掃一掃可加博主微信
所寫所說,是心之所感,思之所悟,行之所得;文當(dāng)無敷衍,落筆求簡(jiǎn)潔。 以所舍,求所獲;有所依,方所成!