Situation
Imagine a research project which has been going on for years and will go on for many more. Project notes have been written until now in MS Word, but we would like to switch to Drupal. The idea is to start writing new project nodes immediately in Drupal (blog, book), and bring old notes from Word into Drupal when time permits in calm periods. The goal is to ultimately have the complete project notes in Drupal, and then publish them.
Problem
Starting to write in Drupal for new notes whilst bringing in the old notes when time permits means that node numbers will correspond with the chronology the notes were entered in Drupal: node/10 could be a node of tomorrow whilst node/567 could be a node of May 1, 2006. We would very much like the node numbers to correspond with their real chronology i.e the original date the note was taken, which will be in the field "Authored On" so that node/1 would be the oldest project note, node/2 the second oldest, etc.
Solution
So how can we get the nodes in that order afterwards? being numbered sequentially in accordance with their dates?
Perhaps nodes can be renumbered in chronological order of "Authored On" via some query?
My level: I'm more a power PC user than a database wizard, but I have managed to learn Drupal administration and can execute a query on the database.
Many thanks in advance,
Paul
Comments
Custom content?
Why don´t you create a new custom content type with cck, including a date field? Haven't used the date field myself, but it seems to me that it can be used for that purpose.
I would prefer to keep using the 'Authored On' date field...
.....so that it will be displayed properly on nodes and node listings without altering any Drupal code that displays content - which I would be able to do anyway.
Thanks very much anyway for the idea of which I hadn't thought.
______________________________
Improving lives effectively
www.pauliliano.com
Rather than use the actual
Rather than use the actual node id, you could wrap it in a URL alias using the Path module in Core, so ../node/234 could also be accessed by something like ../article/YYYY/MM/DD/Article-ID. The Path auto (http://drupal.org/project/pathauto) module accepts tokens and makes this pretty easy. If the site is very large, the lookups of aliases will take some extra time.
Hiding node numbers by using
Hiding node numbers by using aliases is indeed a workable solution. But:
1)I would like to keep things simple, avoid injecting the extra step of aliases, and stick to node/x; I'm not worried about possible SEO implications.
2)The site will have many thousands of nodes (today 5 years worth of daily blog entries + probably hundreds of book pages, with many more coming; the current Word doc has 1200 pages). I didn't realize aliases could bring a performance penalty, but it seems understandable considering they involve extra lookups.
So for the time being, using aliases would be more of a plan B solution, plan A still being to renumber node IDs.
But thanks very much for the excellent input!
______________________________
Improving lives effectively
www.pauliliano.com
requires a lil mysql!
I think you can solve the issue by changing the auto increment number from node table in the drupal database. You can start with the current number in production e.g. 21000. When you change the auto increment number drupal will start assigning the new node number from 21000,21001,21002 and so on.
For the old notes you could try this code in a node using which you can create several nodes in few seconds. You will ofcourse have the choice of assigning your own node ids.
This is a pretty simple piece of code and comes with a lot of variations. Click this page for finding other methods of converting to drupal http://drupal.org/node/67887.
If this doesn't solve your problem then please reply.
Ali Hammad Raza
WordsValley
I probably did not explain well enough
Thanks Ali. I understand you suggest to start entering new entries from a given high node ID like 20000, and importing old nodes with your script. However, nothing is in Drupal yet.
I probably did not explain myself clearly enough. Everything is still in one big Microsoft Word document. All these research notes have to be brought into Drupal, which I suppose will have to be done one at a time, but that's OK since it gives the opportunity to rewrite. The problem is to renumber node IDs afterwards in Drupal so their order reflects the order of the "Authored On" field which will be adjusted manually for every note, and not the date they were entered in Drupal.
So what I'm looking for is a snippet of SQL to renumber the node IDs in an existing database so they reflect the chronological order of the "Authored On" field, and not the order they were entered in Drupal.
______________________________
Improving lives effectively
www.pauliliano.com
I don't think the node id's
I don't think the node id's are really that important. If you keep the authored dates according to the actual dates of your entries, they will automatically be displayed in chronological order. I did something similar on another site. Just use clean urls and the nid wont even be visible.