从Drupal6中删除不需要的样式表

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了从Drupal6中删除不需要的样式表相关的知识,希望对你有一定的参考价值。

Put this in the template.php within your template directory.
  1. /* simple example */
  2. function phptemplate_preprocess_page(&$vars)
  3. {
  4. drupal_add_css(THEMEPATH.'/css/sifr.css','theme');
  5. $css = drupal_add_css();
  6. //unset($css['all']['module']['modules/system/system.css']);
  7. //unset($css['all']['module']['modules/system/defaults.css']);
  8. //unset($css['all']['module']['modules/system/system-menus.css']);
  9. unset($css['all']['module']['modules/user/user.css']);
  10. unset($css['all']['module']['modules/taxonomy/taxonomy.css']);
  11. unset($css['all']['module']['sites/all/modules/cck/theme/content-module.css']);
  12. unset($css['all']['module']['sites/all/modules/logintoboggan/logintoboggan.css']);
  13. unset($css['all']['module']['sites/all/modules/ubercart/uc_product/uc_product.css']);
  14. unset($css['all']['module']['sites/all/modules/cck/modules/fieldgroup/fieldgroup.css']);
  15. unset($css['all']['module']['sites/all/modules/filefield/filefield.css']);
  16. unset($css['all']['module']['sites/all/modules/img_assist/img_assist.css']);
  17. unset($css['all']['module']['sites/all/modules/link/link.css']);
  18. $vars['styles'] = drupal_get_css($css);
  19. }
  20.  
  21. /* whitelist */
  22. function pbot_preprocess_page(&$v)
  23. {
  24. $css = drupal_add_css();
  25. foreach( $css['all']['module'] as $stylesheet => $val )
  26. {
  27. $matches = array();
  28. preg_match('@(devel|date|wysiwyg|tinymce|admin_menu|imce)@',$stylesheet,$matches);
  29. if( strpos($stylesheet,'sites/all/modules') !== false && empty($matches) )
  30. {
  31. unset($css['all']['module'][$stylesheet]);
  32. }
  33. }
  34.  
  35. $v['styles'] = drupal_get_css($css);
  36. }

以上是关于从Drupal6中删除不需要的样式表的主要内容,如果未能解决你的问题,请参考以下文章

PHP 从Drupal 6中删除不需要的样式表

Drupal 6 视图 2:PHP 片段

从css样式表反应类样式不起作用

如何修复重叠的片段

如何使用带有样式表和 xsltproc 的 xslt 从 xml 中删除元素?

样式表将自动删除/取消注册 - WordPress