Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have specific webform call careers , i have use webform localization model but the model does not translate the node title , some one told me to use preprocess node func. but i did not now how to create theme i try to write some thing like this

function [themeName]_preprocess_page(&$variables) {  
  if($node['id'] == 6) {
  $node['title'] = t($node['title']); 
    }

But it does not work

share|improve this question
up vote 1 down vote accepted

The code doesn't work because the function receives only a parameter, and that is not $node. The correct code should eventually be the following one.

function mymodule_preprocess_page(&$variables) {  
  if(!empty($variables['node']) && $variables['node']->nid == 6) {
    $variables['title'] = t($variables['title']); 
  }
}

I am assuming you want to change the title when the node ID is equal to 6.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.