Ok, I am manually putting my existing site's pages into drupal as page nodes. this seems to be working. I can see the html in each node. That is working out ok. What I need advice with is the linking of nodes to each other, with initial content in different directories. For example:
oldindex.php links to file1.php in the same directory and different-directory/file2.php
How would i migrate the content so that the links and structure remain functionally the same? I've looked for a couple of day in the docs.. but I fear that this is something so basic that it is assumed. Can anyone help this poor, confused soul? Drupal will do exactly what i want i think, it's just that i dont know how to link nodes properly... :(
Comments
Confused...
Do you just mean linking each node to one and other? If so, it's a simple:
<a href="/node/123">link</a>the same as you'd usually do. What I'm confused about is that you say you want to link to content in different directories? Why aren't ALL the old pages being migrated into Drupal?If you mean that you don't want to update EVERY single link to being node/this-and-that then you can always install URL aliasing. All you'd do then is enter each pages node address referenced to what the page used to be called and then all the links will be exactly the same. You can even enter them as multi-level directory links, like:
node/123 bizarre/porn.htmlYou can also have two aliases for the same node, which I currently do for my homepage.
I get hits on both still... Anyways, don't really understand your question - but hope this helps!
Pobster
Thank you!
Thanks for your reply. So, from the wording or your post I am guessing that i just toss all my data into drupal, and just let the cms do it's work ... Good, I've gained some experience points.
"Install URL Aliasing" eh?
I'll search for that , thanks again.
are you creating nodes?
From reading your message, I guess (maybe I'm wrong) you're not actually creating new drupal nodes, you're just uploading your old pages in directories, is that correct?
To correctly work with Drupal, you should create new nodes (pages, stories, blog entries etc) and paste the HTML or PHP content from your old pages to the body of the nodes. The links to the nodes will then be 'yoursite/node/xxx'.
"URL Aliasing" is what you get by enabling the path module. You can then make alias 'yoursite/anything_you_like' pointing to 'yoursite/node/xxx'.
Durval Tabach
hmm
I am pretty sure this has been asked before, but is there a way to slurp in a bunch of html pages into nodes? I can write perl to get the data inside the body tags. I guess i could watch the mysql.log to see what goes on when one submits a page, and duplicate that in code... but is there a way to do this through the system?
Check http://drupal.org/node/32597
I posted a reply to a similar question on http://drupal.org/node/32597. It shows how you can call node_save() to build a new node.
In general terms you need to walk through the file system looking for files you want to save.
For each file extract the html you want (at most the part between the body tags).
Construct the information for node_save()
And call node_save() to create/save the new node.
If you want to move all html files into drupal, in PHP you can use th e function $files = file_scan_directory($path, '.*\.html$'); to get a list of the files that end in .html (in this case). $path is set to the base directory where you want scanning to start.
Gracias!
Thank you very much .. this is what i was looking for .. I will read up on the api i guess and give this code a shot.
standalone possible?
ok i am trying this solution .. but is it possible to run this code in a standalone program ? I'd just like to include the necessary classes and just run it in the shell .. add all the nodes quickly and then use drupal to fine tune everything, or redo with new parameters.
Possible?
I find it easy to run inside drupal
When I import html, I write a tempory module for the sole purpose of doing that. It gives me access to the drupal api's without doing anything special.
Such a module only really needs one hook function.
The menu hook, so you can define a path that calls the function that does the processing.
gotcha
Thanks a lot once again... drupal is making more sense every day for me.