开发者

Unset all css, and add a single css for custom independent template at drupal 7

Ho do you unset all css core, contrib, theme, and then add a single custom CSS file for a single special page--special.tpl.php at drupal 7?

I tried using hook_css_alter, but I can not get it to work so far.

function mytheme_css_alter(&$css) {
  $alias = drupal_get_path_alias($_GET['q']);
  $parts = explode('/', $alias);
  if ($parts[0] == 'special') {
    unset($css);
  }
}

I 开发者_高级运维know there is a simple way to do it by commenting $styles at html.tpl.php, but maybe there is a better solution so I don't have to create different html.tpl file.

Any hint would be very much appreciated. Thanks


Your code works for me if I change the line unset($css); to $css = array();

I'm not an expert php programmer so I'm not sure if this is bad convention but clearing the array by overwriting it with a blank one seems to work.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜