سؤال

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)

هل كانت مفيدة؟

المحلول 2

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)

نصائح أخرى

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;
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top