Code

Modify CCK Fields with Drupal hook_form_alter

Here is how to modify a CCK field on a node form in Drupal. In this particular example, the CCK field I am trying to modify is called 'field_news_image' and is inside a CCK Field Group called 'group_image'. The modification hides the field by wrapping a div around the field and setting the div's display to none.

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:

Drupal Bulk Delete Nodes and Reset NID Counter

Here is how to bulk delete a big chunk of nodes for a particular content type in Drupal. This code snippet was taken from here and modified to set a limit so php won't run out of memory and then it tells you how many nodes are still left for that content type. This is easiest to run inside the Devel's module PHP block.

Drupal How to Theme a Views Exposed Filter Form

To theme the exposed filter form on a view in Drupal:

How to Update a Drupal Module

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

Programmatically Display a Certain Page of Data with Drupal Views

Here is how you can programmatically load a Drupal view, then specify a particular page of data to show, then print out the view.

$what_page_to_show = 10;
$view = views_get_view('my_example_view');
$view->pager['current_page'] = $what_page_to_show;
print $view->preview();

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.

Browse an Android Emulator SQLite Database in Eclipse

UPDATE - It appears the Questoid SQLite Browser is no longer available from the maker's website, sorry! Perhaps this link will be of use: http://www.java2s.com/Code/Jar/c/Downloadcomquestoidsqlitebrowser120jar.htm

Electronic Drum Kit in Linux



Pages

Subscribe to RSS - Code