Hold the existing variable and override it
grasp and override the existing variables, to do it we use a function in the template.php file
For example
<?php
function themename_preprocess(&$vars){
$var['title'] = 'your text here';
}
?>
Please note variables have to be passed by reference (&$vars). Please Clear the theme registery after saving the changes. Otherwise they wont pickup the changes you have made. If not clear how to clear the theme registery please visit Clean Theme Registery
Making new variables available in the theme
As we have override the existing variable is assigned in same manner. you need to write the preproccess function in template.php file under the activated theme folder. Do not forget to clear the cache
For example :
<?php
function themename_preprocess(&$vars){
$var['newvariable_name'] = t('your text here');
}
?>
now newvariable_name will available in variable array of theme. Note I have included the t function to provide for translation of the new string.
Printing variable
<?php print $newvariable_name; ?>
Thanks
0 Comment(s)