User login

theming

Use echo instead of print in themes for speed?

Hat tip to RobLoach who noted this in the #drupal IRC channel-- if we want to squeeze hundredths of a millisecond more out of our Drupal modules and themes, we should use echo instead of print for getting the data to the screen.

UPDATE: The PHP developers don't recommend switching from print to echo for speed reasons, suggesting that the difference can be dependent on the setup of your environment.

Random more useful PHP code speed improvements:

How to theme a form in Drupal 6

Theming a form, like theming almost anything in Drupal 6, requires registering the theme function with hook_theme in a module or a theme. The FormAPI docs and the Drupal 5.x to Drupal 6.x form upgrade guide (Drupal 5.x to 6.x FormAPI changes appear to remain a little deficient in explaining this.

See for instance How to theme a form in Drupal 6.x?

Converting Webforms to Display Checkboxes and Radios in Multiple Columns

<?php
/**
 * Implement hook_form_alter().
 *
 * Integrates Multi-column checkboxes radios module with Webform module. Code
 * taken from module by haplo326 http://drupal.org/user/639916 posted to this
 * thread:  http://drupal.org/node/603900#comment-2228686
function agaricgenarts_form_alter(&$form) {

Fixing Zen's false out-of-date update status warning

zen theme claims out of date
zen theme update status out of date

See issue:
Sub-theme's .info file triggers incorrect "out of date" flag in update module
http://drupal.org/node/254821

Resolved:
git commit -m "Remove date from zen subtheme .info to remove bogus Zen theme needs updating message."

git get the diff of a file revision ago

How to add a node id to a page's CSS classes

If your page.tpl.php already prints $body_classes (or equivalent) in the <body> tag, then you likely need only to add a single line to have the nid included with a class such as "node-1".

drupal add node id to theme template
drupal add node id to page template

http://drupal.org/node/360484

Syndicate content