Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

How could I detect if node type is article (in template.php) but process variables only for teaser of article, not article i full mode. (I have template suggestions so i have node--article-teaser.tpl.php). Like:

if ($node->type == 'article' and inject only if article-teaser.tpl.php)

Thanks!

share|improve this question

1 Answer 1

up vote 1 down vote accepted

In a preprocess/process function for the node template file, you just need to check the following variables:

  • $variables['teaser'] must be TRUE
  • $variables['node']->type must be 'article'

$variables is the parameter passed to preprocess/process functions.

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.