- UPDATE/INSERT often can be updated to a single
db_merge
. - Don't forget to
->execute()
yourdb_select/db_insert/etc
- Themes can have many variables and you might want to do
function theme_fivestar_preview($variables) {
$theme_definition = fivestar_theme();
foreach ($theme_definition['fivestar_preview']['arguments'] as $key => $default) {
$$key = $variables[$key];
}
Edit: merlinofchaos suggests simplyextract($variables, EXTR_SKIP);
because that's what templates do.
Commenting on this Story is closed.
The signature of hook_theme is not as easy :( hook_theme($existing, $type, $theme, $path)
I would use
<?php
$hooks = theme_get_registry();
foreach ($hooks['foo']['arguments'] as $key => $default) {
$$key = $variables[$key];
}
?>
Thanks for the info. I just started learning the syntax and the platform! Tell me, can be helpful xp tweaks for it? I'm very grateful for your response!