Making additional variables available to your templates
As the Smarty Theme Engine is very closely ported from phptemplate most solutions are of the same nature.
For simple introduction of additional variables you implement a _smarty_variables function in the smartytemplate.php file within your theme directory (see http://drupal.org/node/70247 : smartytemplate.php: Your theme's powerhouse)
For example:
If your theme were box_grey_smarty:
Adding a smartytemplate.php file at themes/box_grey_smarty/smartytemplate.php with content of (file needs php tags):
<?php
function _smarty_variables($hook, $variables) {
switch($hook) {
case 'comment' :
$variables['newvar'] = 'new variable';
$variables['title'] = 'new title';
break;
}
return $variables;
}
?>Then within your comment.tpl you could then write New Variable: {$newvar} to print 'new variable'.
See the phptemplate page on template variable addition for more examples, just remember to replace _phptemplate_variables with _smarty_variables.
