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

i want to use another page.tpl.php file, if die fb parameter is set. The File is located in my theme folder and has the name "page-fb.tpl.php"

My Function in template.php

function THEMENAME_preprocess_page(&$vars) {
/** Facebook Output */
    if ( isset($_GET['fb']) && $_GET['fb'] == 1 ) {
        $vars['template_file'][] = 'page-fb';
    }
}

The function is called, but the new page-fb.tpl.php is not loaded. I'm doing all of this on Drupal 7.

Any advices?

share|improve this question

2 Answers

up vote 1 down vote accepted

Rename page-fb.tpl.php to page--fb.tpl.php and then modify your code to use $vars['theme_hook_suggestions'][] = 'page__fb'; instead of what you got currently. For further information you can check out the Drupal 7 Template Suggestions page.

share|improve this answer
 
thanks this worked. –  jussi Feb 24 '12 at 10:19

Here you made a mistake!

$vars['template_file'][] = 'page-fb';

The above line should be like below.

$vars['template_files'][] = 'page-fb';
share|improve this answer
 
okay, but is not working either. i think i forgot to mention, it is on drupal 7. –  jussi Feb 24 '12 at 9:46

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.