0

I need to create a copy of page.tpl.php using page--fixed_arg_0__variable_string_arg_1__fixed_arg_2.tpl.php as pattern. For example, if the URL is http://example.com/models/model-title/special-offers, model-title is the variable. I only want one template file instead of 10 or more.

Any suggestions?

1
  • Welcome to Drupal Answers! It's not clear what you are asking, especially because you say you want one template file instead of 10. if page.tpl.php is not enough, you should explain the pattern of the URLs to which you want to apply the same template file.
    – apaderno
    Dec 5, 2015 at 20:45

1 Answer 1

1

What you'd need to do use the theme suggestions. So you'd have 1 template file e.g. page--fixed.tpl.php

Then in template.php you could have an if statement e.g.:

function THEME_preprocess_page(&$variables) {
 $arg1 = arg(1);
 $arg0 = arg(0);
 if($arg0 == 'models' && ($arg1 = 'model-names' || $arg1 = 'anothermodel')){
  $variables['theme_hook_suggestions'][] = 'page__fixed';
 }
}
0

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