开发者

Static HTML to Drupal 7

Peers

I have some static html content which are 120000 files. i want to do an import of all the开发者_如何学编程 files and store individual file contents as nodes. by giving the node title as html file name and node body as html file content, how to do that ?

regards


Here are two solutions you might wanna look up. However, both are for Drupal 6. You might wanna build the site in Drupal 6, and then upgrade to Drupal 7 if you cannot find a solution for D7. It might be easier and faster than doing it directly in Drupal 7

Node Import Module

Import HTML Module

The latter one seems to be made to work with HTML pages.

Cheers

P.S. Just found this other solution Drupal Migrate


You could easily made a script like this :

  $node = new stdClass();
  $node->type = 'youtype';
  node_object_prepare($node);
  // Get Your title ...
  $node->title    = $title;
  $node->language = LANGUAGE_NONE;
  // Get Your body content
  $node->body[$node->language][0]['value'] = $body_content;

Make a loop for each files, the script will take some time to run.


It also seems to me Import HTML module does what you want.

Alternatively, you could consider using Feeds module and write a plugin to Feeds to process your files. We have written a plugin to Feeds to import very large HTML files we converted from PDF reports into Drupal (here are some examples). It works very well and can attach all files to the imported nodes, build navigation menus and rebuild links automatically. If you have complex requirements like we do I suggest investing in writing a Feeds plugin.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜