2

I saw that this was asked few times before, and i tried the answers, and i tried modifying the answers, yet nothing.

Case: I have advanced forums installed, and i am using appcache(don't you dear to run away now!) Obviously i need to turn appcache off when surffing forums, and i managed to make custom html.tpl.html for /forum and /forums, so when i am looking forum list and topic list i wont get cached. But then: When i am looking at forum topic, it is a post ofc, and post type (machine type is forum) and i have defined in template.php:

function flowrox_preprocess_html(&$vars) {
    $node = menu_get_object();

    if ($node && $node->nid) {
        $vars['theme_hook_suggestion'][] = 'html__' . $node->type;
    }
}

and it wont make change.

So i am able to change html.tpl.php for path but not for node type. Help me please and correct my knowledge for making such things.

Thanks for all!!! (btw i dont need a lesson of appcache, sincerely if you have manifest = x.appcache" in your html tag it will cache it, even if it's in network section)

Community
  • 1
  • 1
J0N3X
  • 228
  • 2
  • 14

2 Answers2

4

There is a slight difference between $vars['theme_hook_suggestions'] and $vars['theme_hook_suggestion'].

$vars['theme_hook_suggestions'] is an ARRAY of theme suggestions, and the template at the end of this array has higher priority than preceding ones.

// example
$vars['theme_hook_suggestions'][] = 'html__' . $node->type;

$vars['theme_hook_suggestion'] is a STRING representing the template file to use and it has higher priority than $vars['theme_hook_suggestions']. Which means that if any theme suggestion is passed to $vars['theme_hook_suggestion'], $vars['theme_hook_suggestions'] will be ignored.

// example
$vars['theme_hook_suggestion'] = 'html__' . $node->type;
Muhammad Reda
  • 26,379
  • 14
  • 93
  • 105
1

O M G, I feel so sorry for you now.

It should be $vars['theme_hook_suggestions'] and not $vars['theme_hook_suggestion'] (the s at the end of suggestion)

Pinoniq
  • 1,365
  • 9
  • 13
  • these ffeelingSSS im holding right now. you cant imagine. but yea thanks million times man <3 – J0N3X May 05 '14 at 12:45