1

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?

2 Answers 2

2

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.

0
1

Here you made a mistake!

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

The above line should be like below.

$vars['template_files'][] = 'page-fb';
1
  • okay, but is not working either. i think i forgot to mention, it is on drupal 7.
    – jussi
    Commented Feb 24, 2012 at 9:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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