0

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

tif
  • 1,109
  • 2
  • 12
  • 32
Sirish
  • 1
  • 1
  • 1

3 Answers3

0

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.

Invisigoth
  • 121
  • 1
  • 3
0

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

tif
  • 1,109
  • 2
  • 12
  • 32
  • Thank you for your reply, but can i just write a custom module to fopen the html file and read the contents into node->body and then write a view to display it, so the html will be executed ? – Sirish Jun 16 '11 at 15:09
  • That is what Import HTML module does if I understand right what you are willing to do – tif Jun 16 '11 at 15:16
  • court, i have 120000 html files which are created for a static site, now i have to create a content type, node title and node body, and run through a job to convert all of those into drupal, so node title will be the file name and node body will be the contents of html file. once i am done importing, i have to design a view to show the html content as to how it is designed – Sirish Jun 16 '11 at 15:23
  • Mmm.. I would probably develop a tool in Java or C# to get the file name and file content to a CSV and then use the first module I mentioned to import all the data. The design can be achieved by customizing your node-type template file. I have not developed modules for Drupal so I can't advice you in that department. – tif Jun 17 '11 at 05:36
0

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.

Fedir RYKHTIK
  • 9,844
  • 6
  • 58
  • 68