Drupal and its community issues
I love Drupal. I really do, even if many people do not understand why (one day I will explain to you what you don’t see, guys). I’ve been working with it since the version 4.6. Then, during the 2008/09 I stopped for like a year (for many reasons that are not worth to be told), but eventually I came back aboard, and now I am also the “specialist in charge” for this platform at Ibuildings.
For a long time I never had the chance to contribute “seriously” (just some little patches here and there) in the community, but now different working conditions allow me to do so. This brought to my attention some issues in the community attitude. And when it comes to social attitudes, I am not an easy person to deal with when I get disappointed.
Programmatic CCK Content Types: why my way?
A few days ago, I have announced the Alternate Content Copy module, which hopefully is going to be accepted on the Drupal.org project repository (as soon as I submit it).
In that article I explained the general reasons why those modifications should be part of the official Content Copy module.
Now, I do realise that Fields in D7 might be so different that everything I am about to say could not make any sense in the near future. However, I would like, with this article, to explain why the programmatic update of CCK content types does benefit of my modifications.
Programmatic CCK Content Types – Updated
Not long ago, I published a HowTo for creating CCK Content Types programmatically, including the ability of updating them via code. After some events, the HowTo needed an update, as it now (necessarily) depends on the Alternate Content Copy module.
CCK – Alternate Content Copy
Eventually, markus_petrus did not want to change the current behaviour of the CCK Content Copy module. Therefore, out of box, it won’t allow you to use my way to get CCK content type done programmatically (well, not including the update of them). But let’s forget about this for now. Let’s focus on CCK and the Content Copy module.
Programmatic CCK Content Types – The Patch
UPDATE 02/12/2009: this patch is out of the date, please refer to the Alternate Content Copy module now.
A few days ago I wrote a HowTo for creating CCK Content Types programmatically, including their update. Unfortunately, I must have missed something in my tests, so I found out later on that the updates won’t work properly.
This is due to the behaviour of the CCK import procedure, that skips already existing fields, so these don’t get updated. Plus, it also keeps fields no longer available in the updated content type definition, i.e. you cannot drop fields either.
I submitted a patch to the content_copy module, which turned up to be kind of a duplicate. Now the discussion is going on here, and my latest comment (including my patch) is here.
At the moment, Markus does not seem keen to include this patch, or any similar one, at all. We’ll see what happens.
In the meantime, I am using an alternative approach, because I don’t like to have patched modules in my installations. Basically I wrote a module called custom_content_copy that implements an alternative submit handler for the Content Copy import form. This way, you just need to install this module alongside of the content_copy module provided by CCK.
If you want, you can download this module here:
Custom Content Copy. Please refer to the Alternate Content Copy module now.
Programmatic CCK Content Types
Update 28/11/2009: you need this patch to make this working 100%.
The fundament of Drupal is the node entity. In drupal (almost) everything is a node, which is the most elementary piece of content available, that can be “extended” to create new node types, also known as content types.
When you create new Drupal content types in the “classical” way, you do that by creating a new module. This way a content type is portable across different Drupal installations, just by copying and enabling the module in a new CMS instance.
Originally this was the only way to create content types. Then, CCK was created and it changed the life of many people, especially of those who use Drupal just as CMS. However, these people tend to create content types by means of the UI provided by CCK and to store them into the DB. This way a content type is not portable. Plus, it is not really friendly with complex development scenarios where Drupal is heavily used as framework and the code must be deployed across multiples environments.
Fortunately, we can achieve the same flexibility of the classical method, and more, taking advantage of all the CCK features, including the built-in integration with Views. Let’s see how. All you need is the latest versions of Drupal 6, CCK (and, optionally, Views).
Spelling correction with Soundex

A few days ago Ian Barber wrote an article about the automated spelling correction.
Today I had the time to read it. Good quality and great presentation as always. However, the first thing I noticed is that the solution presented by Ian was not making use of the Soundex algorithm at all, which seemed slightly strange to me according to my experience. So, I have quickly refined that solution using the standard soundex() PHP function.
Google and PHP optimisation
Back in June, this article appeared on Google Code, containing very superficial statements about how to optimise a PHP script. Fortunately, the community never sleep.
Is PHP ready for the Enterprise?
Come on, tell me, how many times have you heard that question? No, stop counting with your fingers: they are not enough. Nowadays — just a month ago for example — we still have this question coming out every now and then.
I think the answer that can stop this question for a long time, let’s say forever, can be found in the article I linked above (which of course it’s the same thing I would say to anyone asking this question):
I think the sheer amount of large, complex websites (Facebook, Yahoo, Flickr) based on PHP, sheer amount of complex off-the-shelf apps (SugarCRM, OpenPro, CMS’s) based on PHP and enterprises relying on PHP for either their corporate websites or their internal systems – is a testament to the fact that PHP’s feature set is mature and that we should continue in the same direction.
Well, maybe it’s not exactly the form I would have used. I can imagine I would have said something like:
Please, just pay attention to the extension of this URL: http://www.facebook.com/home.php. Cheers.



Recent Comments