Category Archives: PHP

Drupal with Dreamweaver

I had to migrate and setup the whole workspace at my old desktop machine last week after the breakdown of my HP notebook. So while setting it up I thought this little piece of trick could help someone who is fond of Dreamweaver and looking for an IDE to code Drupal.

As a side note, one could accuse me of promoting unethical software and in fact I don’t refute it (even though it is not my intention). I also know there are many great open source editors for coding PHP like Eclipse-PDT and even Gedit which could be transformed to a very helpful IDE. But on other hand I’m kind of addicted to DW after long years of working with it and if someone who already has DW looking for a way to use it for coding Drupal this could be helpful.

The most frustrating thing when coding Drupal modules or themes with DW is that it doesn’t recognize it as a PHP script and doesn’t give any validation or auto completion features like it usually does for php scripts. To fix this there’s little configuration to be done.

First find the installed directory of DW (if it’s Windows it most probably in ~/Program Files or if it’s Linux+wine it should be in your virtual windows environment) and go to Configuration->DocumentTypes. There should be a xml file called MMDocumentTypes that holds configurations regarding which language should be used for a given file format.

Find the line that says,
‘<documenttype id=”PHP_MySQL” servermodel=”PHP MySQL”….’
and depending on weather you are using windows or mac, append ‘,module,install,theme,inc’ to existing winfileextension or macfileextension values.

So for windows it should look like this.

<documenttype id=”PHP_MySQL” servermodel=”PHP MySQL” internaltype=”Dynamic” winfileextension=”php,php3,php4,php5,module,install,theme,inc” />

Now restart DW and open your module or theme file. Ta da!..it should now work as a normal php script.

Hope this will be helpful to someone looking for a way to convert Dreamweaver to a more Drupal friendly place.

Tagged , ,

PHP + Large files

I was working on the project Hotelotravel for last few months and as usual in many cases it involved working with large database files because when you consider all hotels, locations and images all over the world it means a lot. But if we want to do large file uploads or database updates with PHP there are few configurations to be done to default settings and I’m putting this as a note to myself (I’m always keep forgetting this) as well as to any one who may find this useful like when importing a large backup file through phpMyAdmin.

In your php.ini check for these settings and change them as you need.

  • post_max_size (The maximum size of post data you can send in one submission)
  • upload_max_filesize (Maximum size of file that can be uploaded)
  • memory_limit (Maximum memory limit that can be allocated for a script execution)
  • max_execution_time (Maximum time limit for a script execution)

As a side note, if you trying to import large files (backups.etc) through phpMyAdmin and it refuses, you may need to edit config.inc.php file and change these settings to 0 which means no limit.

  • $cfg[‘ExecTimeLimit’]
  • $cfg[‘MemoryLimit’]

As a final note, these settings are there for a purpose. So my advice is change them in whatever manner  you want in a development environment but be very careful when setting them in a production environment because an endless execution of a script can cause your servers to waste bandwidth and even crash.  So I guess this is my disclaimer 😉

Tagged ,

Favour returned to Drupal

As I mentioned in an earlier post we, people at Vesess now use Drupal heavily for our developments. We built our new job protal Plex using Drupal as the base and through heavy use of modules provided by Drupal community. Therefore I felt we need to make a return contribution to the Drupal community.

The best way to pay back the favour is contributing to the Drupal community. So here is my first Drupal module release ( and hope it will be only one in many to come).

Name : RequestInvitation

Dependencies : Invite

Licence : GPL

Backend and front of requestinvitation module

Tagged

MySQL South East Asia Roadshow 2007

Yesterday there was a summit organized by hSenid and the speaker was David Axmark, Co-founder and Vice President of MySQL. He talked about the future versions of MySQL and enhancements about to come.

According to David, MySQL 6.0 beta should be released in February next year and 7.0 should be released by the end of 2009. More attention will be given to Falcon, the new DB engine and into optimizing sub queries. In fact, improved 6.0 version should perform a sub query in 1.8 seconds which now takes 12 minutes.

But as a web developer most intriguing fact is the online backup function that will be available in next version. Now when there’s a need to give the ability to create a online backup option I use an export script from phpMyAdmin. But it’s a messy job. So next version of MySQL should make developer’s life bit easy.

Drupal-The best open source CMS of the year

First let me say a big sorry for being absent for more than two months of time. I was having sort of a writers block and didn’t have a mind to write anything. But that doesn’t mean I was idle for the whole lot of time.

In fact, it has been good in regards to my work at Vesess. After last year exams were over, I put all my effort into finishing some works that have been elongating. And I also got the chance to help build our new job portal Plex.lk which opened to public recently and seems promising.

The specialty of Plex is that it is totally based on Drupal, which is the best Open Source CMS in Open Source CMS awards, 2007. The experience is totally exhilarating, when compared to some other CMS such as Expression Engine (I will write about that experience later)

The work I did mostly involved around module customization. Actually I had to create a new module for the site and I’m on my way publishing it to Drupal community. One of the best things about Drupal is that its huge array of modules, which covers almost everything. But when we were going to launch the site we were presented with a requirement to moderate invitations (since the site is still in beta) and we were unable to find a suitable module for that. So I created a new module which use one existing module – Invite and I named the new module ‘Invite Request’. (The new module is in use, you can see it in right hand side bar of Plex.lk)

I guess I will be seeing more of Drupal in future as Plex.lk is still on its way and there’s lot more work to be done. And it’s a good news because I’m enjoying my work with Drupal.