stickee

Homepage settings for multi-language sites in Drupal

written by Karl Binder | April 12, 2012

When creating multi-language websites in Drupal you can use a number of modules to provide languages and translations. These include the Locale and i18n modules. However you may get stuck wondering why, despite translating your homepage node (for example node/1) into another language, it does not switch to the translated node when you choose a […]

Read full details

Count total number of Drupal Nodes of a specific type

written by Karl Binder | August 2, 2010

This little snippet below is handy for getting the total number of nodes on the site of a specific type. In this case I am using it to get the total number of nomination type nodes added to a website. <?php // for Drupal 6.x $count = db_result(db_query(“SELECT COUNT(*) FROM {node} WHERE type = ‘nomination’”)); […]

Read full details

Drupal – manually creating graphs with View variables

written by Karl Binder | April 24, 2010

This PHP snippet is pretty customised but shows how you can use variables passed in a view to created more graphical representations of the results with just CSS and no need for a graphs module. This snippet calculates percentage heights of a total graph area for each node in the view result and then sets […]

Read full details

Drupal Block visibility based on TERM: Site Sections

written by Karl Binder | January 12, 2010

<?php // This snippet returns TRUE if the node we are // currently viewing is tagged with a term which is // the ‘desired_term’ and we are not in edit mode (arg(2)).  // put here the term ID you’re interested in $desired_term = 59; if ( arg(0) == ‘node’ and is_numeric(arg(1)) and arg(2) == FALSE […]

Read full details

Drupal – Show all Args on a page

written by Karl Binder | July 9, 2009

You can add this snippet to any template page in Drupal to echo out all available variable on a page. print_r(func_get_args());

Read full details