function recipe_unit_abbreviation in Recipe 5
Same name and namespace in other branches
- 6 recipe.module \recipe_unit_abbreviation()
Converts a recipe unit ID to it's abbreviation
1 call to recipe_unit_abbreviation()
- theme_node_recipe in ./
recipe.module - A custom theme function.
File
- ./
recipe.module, line 802 - recipe.module - share recipes for drupal 5.x
Code
function recipe_unit_abbreviation($unit_id) {
static $abbreviations;
if (!$abbreviations) {
$rs = db_query('SELECT id,abbreviation FROM {recipe_unit}');
while ($unit = db_fetch_object($rs)) {
$abbreviations[$unit->id] = $unit->abbreviation;
}
}
return $abbreviations[$unit_id];
}