drupal 7.x

Programmatically Render Image Style for Image Field with Drupal

Drupal 6

Here is a function that you can pass an imagecache preset name and a drupal image file path to and it will try to build a derivative image from the preset name and return to you the path to the derived image:

How to Update a Drupal Module

This is a modified snippet from the discussion at: http://drupal.org/node/672472

Return Drupal CCK Integer Field Allowed Values List as Array

Drupal 6 (D7 below)

Below is a helpful function that will return the allowed values list for a Drupal CCK Integer Field as an Array.

For example, here is my allowed values list for my cck integer field "field_dg_hole_tee":

Drupal - Use Drush to Export/Import a MySQL Database Dump File

Export Database to File

So today I wanted to learn how to export a Drupal database to a file quickly. Back in the day I would've logged in through cPanel and navigated to PHPMyAdmin, then manually select an export of the database and have to choose where to save the file. Not to mention all the previous steps listed would need to be preceeded by a Drupal cache flush (I don't like the cache inside a database backup). Typically this would've taken me about 5 minutes to complete, well my friends, no longer is that the case.

Drupal - Post Data via Ajax to PHP Menu Callback with JQuery and JSON

Drupal 7

I found this solid example for Drupal 7.


The code for D7 is much more elegant, there are some great new features in D7 to make this stuff easier.

Drupal 6

Put this PHP code inside your module, e.g. sites/all/modules/my_module/my_module.module

Drupal - Theme Table Example

Drupal 7

$header = array();
$header[] = array("data" => "Column Header Title 1");
$header[] = array("data" => "Column Header Title 2");

$row = array();
$row[] = "Row Column 1 Data"; 
$row[] = "Row Column 2 Data";

$rows = array();
$rows[] = $row;
$html = theme('table', array('header' => $header, 'rows' => $rows));

Drupal 6

Drupal - Fatal error: Allowed memory size exhausted

Drupal can be a memory hog, it's very hungry. Occassionally you may run out of memory when trying to enable a module or some other feature. If this happens, you'll probably see a message similar to the following

Fatal error: Allowed memory size of # bytes exhausted (tried to allocate # bytes) in includes/database.mysqli.inc

To fix this problem, I opened my sites/default/settings.php and added the following php ini setting:


Subscribe to RSS - drupal 7.x