Tim Kamanin shows us how to create Drupal 7 content, comments and categories programmatically, ie. using PHP code rather than the administration user interface.
Knowing how to do this is one of the keystones to building modules that are useful and when using Drupal as a framework of sorts. It also a very important set of tools to have when migrating from another CMS or importing external data.
I've been busy with a migration work for my client recently. There is an established website built with some proprietary CMS with a decent amount of articles / pages, different categories and user comments. My team was hired to make a complete migration from this money-sucking old-fashioned proprietary CMS to a modern shiny open-source Drupal 7. I like this kind of tasks. It’s always a pleasure to help people get rid of an old and proprietary technologies. To accomplish this task, I needed to create nodes, comments and taxonomies programmatically in Drupal 7, which is a pretty trivial task for Drupal 6. But in D7 with the introduction of entities and fields in core (aka CCK in core) things have changed a bit.
