开发者

How would the conversion of a custom CMS using a text-file-based database to Drupal be tackled?

Just today I've started using Drupal for a site I'm designing/developing. For my own site http://jwm-art.net I wrote a user-unfriendly CMS in PHP. My brief experience with Drupal is making me want to convert from the CMS I wrote. A CMS whose sole method (other than comments) of automatically publishing content is by logging in via SSH and using NANO to create a plain text file in a format like so*:

    head<<END_HEAD
title   = Audio
keywords= open,source,audio,sequencing,sampling,synthesis
descr   = Music, noise, and audio, created by James W. Morris.
parent  = home
    END_HEAD

    main<<END_MAIN
text<<END_TEXT
Digital music, noise, and audio made exclusively with
@=xlink=http://www.linux-sound.org@:Linux Audio Software@_=@.
  END_TEXT

image=gfb@--@;Accompanying image for penonpaper-c@right
ilink=audio_2008
br=
ilink=audio_2007
br=
ilink=audio_2006
    END_MAIN

info=text<<END_TEXT
I've been making PC based music since the early nineties - 
fortunately most of it only exists as tape recordings.
  END_TEXT

( http://jwm-art.net/dark.php?p=audio - There's just over 400 pages on ther开发者_开发技巧e. )

*The jounal-entry form which takes some of the work out of it, has mysteriously broken. And it still required SSH access to copy the file to the main dat dir and to check I had actually remembered the format correctly and the code hadn't mis-formatted anything (which it always does).

I don't want to drop all the old content (just some), but how much work would be involved in converting it, factoring into account I've been using Drupal for a day, have not written any PHP for a couple of years, and have zero knowledge of SQL?

How would I map the abstraction in the text file above so that a user can select these elements in the page-publishing mechanism to create a page?

How might a team of developers tackle this? How do-able is it for one guy in his spare time?


You would parse the text with PHP and use the Drupal API to save it as a node object.

http://api.drupal.org/api/function/node_save

See this similar issue, programmatically creating Drupal nodes:

recipe for adding Drupal node records

Drupal 5: CCK fields in custom content type

Essentially, you create the $node object and assign values. node_save($node) will do the rest of the work for you, a Drupal function that creates the content record and lets other modules add data if need be.

You could also employ XML RPC services, if that's possible on your setup.


Since you have not written any PHP for a long time, and you are probably in a hurry, I suggest you this approach:

  • Download and install this Drupal module: http://drupal.org/project/node_import
    This module imports data - nodes, users, taxonomy entries etc.- into Drupal from CVS files. read its documentations and spend some time to learn how to use it.
  • Convert your blog into CVS files. unfortunately, I cannot help you much on this, because your blog entries have a complex structure. I think writing a code that converts it into CVS files takes same time as creating CVS files manually.
  • Use Node Import module to import data into your new website.

Of course some issues will remain that you have to do them manually; like creating menus etc.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜