? generate-content.php ? generate-taxonomy.php ? modules/devel Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.549 diff -u -F^f -r1.549 common.inc --- includes/common.inc 19 Jul 2006 07:45:35 -0000 1.549 +++ includes/common.inc 24 Jul 2006 20:10:38 -0000 @@ -115,7 +115,7 @@ function drupal_set_html_head($data = NU */ function drupal_get_html_head() { $output = "\n"; - $output .= theme('stylesheet_import', base_path() .'misc/drupal.css'); + drupal_add_css('misc/drupal.css', 'core'); return $output . drupal_set_html_head(); } Index: includes/theme.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/theme.inc,v retrieving revision 1.303 diff -u -F^f -r1.303 theme.inc --- includes/theme.inc 13 Jul 2006 13:11:36 -0000 1.303 +++ includes/theme.inc 24 Jul 2006 20:10:39 -0000 @@ -53,19 +53,19 @@ function init_theme() { // If we're using a style, load its appropriate theme, // which is stored in the style's description field. - // Also load the stylesheet using theme_add_style(). + // Also add the stylesheet using drupal_add_css(). // Otherwise, load the theme. if (strpos($themes[$theme]->filename, '.css')) { // File is a style; loads its CSS. // Set theme to its template/theme - theme_add_style($themes[$theme]->filename); + drupal_add_css($themes[$theme]->filename); $theme = basename(dirname($themes[$theme]->description)); } else { // File is a template/theme // Load its CSS, if it exists if (file_exists($stylesheet = dirname($themes[$theme]->filename) .'/style.css')) { - theme_add_style($stylesheet); + drupal_add_css($stylesheet); } } @@ -325,29 +325,44 @@ function theme_get_setting($setting_name } /** - * Add a theme stylesheet to be included later. This is handled separately from - * drupal_set_html_head() to enforce the correct CSS cascading order. + * @param $path + * The path to the CSS file relative to the base_path(), e.g., /modules/devel/devel.css + * @param $type + * The type of stylesheet that is being added. Types are: core, module, and theme + * @param $media + * The media type for the stylesheet, e.g., all, print, screen + * @return + * An array of CSS files */ -function theme_add_style($path = '', $media = 'all') { - static $styles = array(); +function drupal_add_css($path = NULL, $type = 'module', $media = 'all') { + static $css = array('core' => array(), 'module' => array(), 'theme' => array()); - if ($path && !isset($styles["$media:$path"])) { - $style = new stdClass(); - $style->path = base_path() . $path; - $style->media = $media; - $styles["$media:$path"] = $style; + if (!is_null($path)) { + $css[$type][$path] = array('path' => $path, 'media' => $media); } - return $styles; -} + + return $css; +} /** - * Return the HTML for a theme's stylesheets. + * @param $css + * An array of CSS files + * @return + * A string of XHTML CSS tags */ -function theme_get_styles() { - $output = ''; - foreach (theme_add_style() as $style) { - $output .= theme('stylesheet_import', $style->path, $style->media); +function drupal_get_css($css) { + // load the CSS in order, with core CSS first, then module CSS, then theme CSS + // this ensures proper cascading of styles for easy overriding + foreach ($css['core'] as $core) { + $output .= theme('stylesheet_import', base_path() . $core['path']) ."\n"; + } + foreach ($css['module'] as $module) { + $output .= theme('stylesheet_import', base_path() . $module['path']) ."\n"; + } + foreach ($css['theme'] as $theme) { + $output .= theme('stylesheet_import', base_path() . $theme['path']) ."\n"; } + return $output; } @@ -392,7 +407,7 @@ function theme_page($content) { $output .= ''; $output .= ' '. (drupal_get_title() ? strip_tags(drupal_get_title()) : variable_get('site_name', 'drupal')) .''; $output .= drupal_get_html_head(); - $output .= theme_get_styles(); + $output .= drupal_get_css(drupal_set_css()); $output .= ' '; $output .= ' '; @@ -433,7 +448,7 @@ function theme_maintenance_page($content $output .= ''; $output .= ' '. strip_tags(drupal_get_title()) .''; $output .= drupal_get_html_head(); - $output .= theme_get_styles(); + $output .= drupal_get_css(drupal_set_css()); $output .= ''; $output .= ''; $output .= '

' . drupal_get_title() . '

'; @@ -462,7 +477,7 @@ function theme_install_page($content) { $output .= ''; $output .= ' '. strip_tags(drupal_get_title()) .''; $output .= drupal_get_html_head(); - $output .= theme_get_styles(); + $output .= drupal_get_css(drupal_set_css()); $output .= ''; $output .= ''; $output .= '

' . drupal_get_title() . '

'; Index: sites/default/settings.php =================================================================== RCS file: /cvs/drupal/drupal/sites/default/settings.php,v retrieving revision 1.31 diff -u -F^f -r1.31 settings.php --- sites/default/settings.php 14 Jul 2006 02:21:52 -0000 1.31 +++ sites/default/settings.php 24 Jul 2006 20:10:39 -0000 @@ -84,7 +84,7 @@ * $db_url = 'mysqli://username:password@localhost/databasename'; * $db_url = 'pgsql://username:password@localhost/databasename'; */ -$db_url = 'mysql://username:password@localhost/databasename'; +$db_url = 'mysql://drupal:drupal@localhost/drupal_cvs'; $db_prefix = ''; /** Index: themes/engines/phptemplate/phptemplate.engine =================================================================== RCS file: /cvs/drupal/drupal/themes/engines/phptemplate/phptemplate.engine,v retrieving revision 1.36 diff -u -F^f -r1.36 phptemplate.engine --- themes/engines/phptemplate/phptemplate.engine 2 Jul 2006 19:00:21 -0000 1.36 +++ themes/engines/phptemplate/phptemplate.engine 24 Jul 2006 20:10:39 -0000 @@ -205,7 +205,8 @@ function phptemplate_page($content) { 'sidebar_right' => $sidebar_right, 'site_name' => (theme_get_setting('toggle_name') ? variable_get('site_name', 'Drupal') : ''), 'site_slogan' => (theme_get_setting('toggle_slogan') ? variable_get('site_slogan', '') : ''), - 'styles' => theme_get_styles(), + 'css' => drupal_add_css(), + 'styles' => drupal_get_css(drupal_add_css()), 'tabs' => theme('menu_local_tasks'), 'title' => drupal_get_title() );