In template.php I have created the following function.
function mytheme_preprocess_node__post_esl_material(&$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 '<div class="article">'; echo '<h4>ARTICLE</h4>'; echo '<div class="field_article">'; print render($content['field_article']); echo '</div>'; echo '</div>'; }
Print
$article
innode--post-esl-material.tpl.php
and hence, have the PHP logic within template.php.
I am using Drupal 7 with the Stark theme.