Main image
1st October
2008
written by david

I updated the code to provide content type and cck field information for custom modules to work with Drupal 6.

This is the method I’m using to run the import. This method resides in a site_profile module I use for common functions for restoring sites via installation profiles for deployment.

It works using exported ‘macros’ from the content_copy module data export form. The cck content_copy handles all the content type and field importing. If the types or fields already exist, they are not duplicated and are handled gracefully. Feedback is provided as fields and types are added.

I usually add a folder called ‘cck’ to my module folder and copy and paste the content_copy export data structure into separate files, like this

  • …/modules/my_module
  • …/modules/my_module/cck
  • …/modules/my_module/cck/my_content_type.inc
  • …/modules/my_module/cck/my_other_content_type.inc

I simply copy and paste the exported data from admin > content types > export into the .inc files.(…)

Click to continue reading “Define content types and CCK fields for your custom module using content_copy”

21st September
2008
written by david

I recently needed to programmatically create CCK fields for a custom module.
I wanted to be able to install my module and automatically create it’s required CCK fields.
I ended up using the following code function:(…)

Click to continue reading “Programmatically create CCK fields”

21st September
2008
written by david

Recently I found myself wanting to add and remove stylesheets via template.php
I thought there must be a way to do it via the _phptemplate_variables function.
Sure enough, there is:(…)

Click to continue reading “How to add and remove stylesheets in template.php”