I am unable to create a variable in template.php that I later want to use in node--content-type.tpl.php In template.php I have created the following function.

function mytheme_preprocess_node__post_esl_material(&amp;$variables){
  $variables['linking'] = 'yes baby';
}


In node--post-esl-material.tpl.php I am trying to print $linking, but it is not working. The reason I am trying this is because I heard from an expert in Drupal saying:


  Template files are usually used to change the CSS. You do not want to put too much PHP logic here. The PHP logic is typically included in your template.php file.


Therefore the objective, after getting the above code to work, would be to:


Create a $article variable in template.php.
Swap the following code from node--post-esl-material.tpl.php into template.php.

if (empty($content['field_article'])) {
  echo '';
}
else {
  echo '&lt;div class="article"&gt;';
  echo '&lt;h4&gt;ARTICLE&lt;/h4&gt;';
  echo '&lt;div class="field_article"&gt;';
  print render($content['field_article']);
  echo '&lt;/div&gt;';
  echo '&lt;/div&gt;';
}

Print $article in node--post-esl-material.tpl.php and hence, have the PHP logic within template.php.


I am using Drupal 7 with the Stark theme.
These are the steps I would take to resolve (re-trying after each step)


Clear theme registry cache - /admin/config/development/performance - Clear Cache
Use the more general function mytheme_preprocess_node($variables), clear cache, try again


If the more general function works, your issue is likely that you have incorrectly named the template, try:kpr($vars['theme_hook_suggestions']) if you have the Devel Module installed.  If not, you should. Otherwise you can print_r($vars['theme_hook_suggestions']).  Is your template included in there?