Drupal
Migrating data in Drupal 5 to 6 using Table Wizard and Migrate (Part 4 - Product Nodes)
Product nodes
So the next step is bringing in the product nodes. As I mentioned in the company node migrate post, I have some custom text fields with taxonomy terms in them, as well as a regular taxonomy, and a node reference field (for the company that makes the product).
The custom text fields' data and the regular taxonomy terms must get moved into new Content Taxonomy fields. The node reference must have its node id number updated to get the new company node id.
Moving imagecache presets to a module
Quick post to show you how to move your Drupal 6.x imagecache presets to a module. This is for imagecache-6.x-2.0-beta10 or higher.
Create your presets in Drupal. Once they're all done, go to the ImageCache list page and click the export link next to the first preset. Copy the code presented to you, and paste it into your module using a function called hook_imagecache_default_presets(). Add a return $presets at the end of the function and save the module.
- dave's blog
- Login to post comments
- Read more
Migrating data in Drupal 5 to 6 using Table Wizard and Migrate (Part 3 - Company Nodes)
After importing taxonomies and users, now I need to bring in the actual nodes. First thing to do is remove the primary key option from the node table's vid field. Remember, Table Wizard only works when the table has a single primary key.
Alright, so the things that need to be updated during the migrate are the taxonomy terms for each node, any node-reference fields (user-reference fields are fine as-is because we simply copied the existing user base to the new site), and our meta tags from the nodewords module.
Migrating data in Drupal 5 to 6 using Table Wizard and Migrate (Part 2 - Users & Profiles)
Well, it looks like the users are pretty simple to do. Just overwrite the Drupal 6 profile_fields, profile_values, role, users, and users_roles tables with the Drupal 5 ones. No need to do any importing (which would have been pretty complicated with all the profile values in there).
Couple of things to watch for though:
Migrating data in Drupal 5 to 6 using Table Wizard and Migrate (Part 1 - Taxonomies)
This will be the first in a few posts on how I am trying to move data in a series of Drupal 5 sites to one Drupal 6 site.
- dave's blog
- Login to post comments
- Read more
Adding an "active" CSS class to the <li> element in menus
I seem to keep finding different ways to add an "active" CSS class to <li> elements in menus. I must have been a bit dense, but it took me a little while to figure that menus are displayed using different methods, hence they need different ways to add in the extra class. Here are the methods:
- Using theme_menu_tree e.g. Navigation menu, any menu shown via a block.
Adding an "active" class to menu links
This method works on all menus that are displayed as blocks i.e. not primary or secondary links. These sorts of menus are created using the theme_menu_tree() function. The process here is a bit more complicated than for primary links, but all you have to do is paste in the code below (I have done all the heavy lifting for you).
Put this in template.php somewhere:
Adding an "active" class to primary links - Option 1
Because primary links use theme_links to generate their output, we could override that theme and add in our own code to get an "active" class on the <li> element. Drupal 6 made some improvements to 5's theme_links function, so I used that version and added in some code to check for the front page too.
SEO, Meta Tags module and <title> tags
If you're one of those SEO obsessed people and if you're also a Drupal user, then you'll probably know about the Meta Tags module (also called Nodewords). You might even know about the Page Title module too. And, just maybe, you've also tried to find a way to change the <title> text, not only on nodes (which Page Title does just fine), but also on taxonomy/term pages (which neither module does at all).
Tertiary menus in Drupal
In keeping with the theme of the previous post, here is another fantastic tip for pulling out more levels of your primary links menu.
By default, Drupal gives you primary and secondary links. These can come from the same menu tree; primary links will be the first level, and secondary links will be the second level. But what happens when you want the third level? Drupal does not give you this variable by default.
