Entries Tagged as 'Drupal 6'

Navicat Connetion with MAMP Pro

MAMP Pro has a lot of nice features. However, this means it changes things up a bit. How you make a connection with Navicat is one such example. So here is a quick helper post get Navicat up and running with MAMP PRo.

1) Add your information to the “Connection Properties” Pane as you normally would.

Navicat Pane -General

2) Click on the “Advanced” pane and check the box next to “Use socket for localhost connection.”

3) Then for the “Socket File Path” field type the following path.

/Applications/MAMP/tmp/mysql/mysql.sock

The “Advanced” Pane should now look like this:

Navicat Advanced Pane

Click “OK” and you should be all set.

Navicat Connection Sucessfull

I hope this helps. Please feel free to make comments.

Drupal Notes

It has been said that Drupal is well documented. While it true that Drupal is “well documented”, it can also be said the Drupal is not “documented well”. There are plenty of documents describing functions and modules and their purpose. However, for those of us that are trying to learn a new system, albeit an excellent one, the whole thing can be rather abstract. For example, I have been spending the last 8 hours learning about the Drupal Form API. I easily grasped the concept of putting the form elements into arrays and construction the form from the array. I understand that the drupal_get_form($form_id) is the “key” function in the Drupal Form API. I even picked up on the the fact that the name of the function that I am supposed to create to build the form’s array of elements will be the name of the form id. But I still struggle with things like say, where do I use the function to build the form? In the template.php file? In the module? I’m not opposed to a little trial and error but sometimes I fill like a blind-folded bull in a china shop with the fire sprinklers gone off ( not to imply that all china shops have fire sprinklers).

So this blog will attempt to simply the otherwise abstract and “well documented” Drupal platform in a way that I and/or people like me (who like to be told how things work and where to put them) can understand.

If you find any great resources that lean toward a lot more hand holding let me know, I’ll be happy to link to them from here.

Schema Data Structure Documentation in Drupal

I have been working on a project on the Drupal 6 platform that requires the web application to recognize dynamically created sub-domains so the functionality of the database can be adjusted according to what sub-domain is in the current URL.

To get Drupal 6 to do this, I am creating a custom module. One of the things I have learned about creating a custom module in Drupal 6 is the implementation of the module’s “install” file.

If you create a module named say,  my_module.module then the module’s install file name would be  my_module.install and will reside in the directory named my_module located at….

my_site/sites/all/modules/my_module

Drupal 6 Module Install File Documentation

The  .install file will be run by Drupal 6 the 1st time my_module has been enabled. The my_module.install file will then be used to run setup procedures as stipulated by your module. The most common task for the my_module.install file to perform is creating database tables and fields. There is no special syntax for the install file. It is simply a PHP file with a .install extension to properly identify it to the Drupal 6 platform.

There is special function used in the .install file called hook_schema(). Where hook would be replaced by the name of your module. For example, if  the module you create is named my_module, then you would create a PHP file and name it my_module.install. Inside that file you will create a function named  my_module_schema(). The my_module_schema() function is used to create arrays representingthe database tables you wish the module to create in the Drupal database. You can see how this works here.

Why do it this way?

Once you build the Drupal API Schema there is no more need for  separate CREATE TABLE or ALTER TABLE statements on each database. As a module developer, you only need to create a schema structure and/or use the Drupal Schema API functions, and Drupal takes care of the rest. This greatly simplifies  writing install and update functions.

This way of creating the module install files also allows for support in multiple database platforms.

According to Drupal’s Blog this also allows for “Several advanced capabilities, such as incremental database updates, a simple and consistent CRUD API, form scaffolding, simpler CCK and Views, schema and data validation, become much easier to implement in future enhancements.”

Schema Data Structure Documentation by Drupal

View Paul Leasure's profile on LinkedIn