PHP block snippets

This section presents a collection of custom blocks submitted by Drupal users. Other examples of custom block examples are available in the "Blocks" section of the Drupal CVS Repository at http://cvs.drupal.org/viewcvs/drupal/contributions/tricks/blocks/.

You can study how the preinstalled Drupal blocks work by searching the associated module files for the string "_block". All blocks defined in a module begin with this hook.

Have a look to see what is put into $blocks["subject"] and $blocks["content"]. The login-block, for example, is implemented in the user module's user_block() function as block 0 ("case 0:" - this delta is there because the user module defines more that one block).

More examples of PHP code snippets can be found in the snippets section.

 
 

Drupal is a registered trademark of Dries Buytaert.