Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
function _advanced_forum_add_files() {
// This could get called more than once on a page and we only need to do it once.
static $added;
if (empty($added)) {
$added = TRUE;
$lineage = advanced_forum_style_lineage();
$lineage = array_reverse($lineage, TRUE);
$theme_path = advanced_forum_path_to_theme();
foreach (array('structure.css', 'style.css', 'images.css') as $css_type) {
$css_file = "$theme_path/advanced-forum.$css_type";
if (file_exists($css_file)) {
// CSS files with no style name in the theme directory trump all
// to provide a theme specific style override.
drupal_add_css($css_file);
}
else {
// For each style from the current style on up through each parent
// style, look for the style specific CSS file first in the active
// theme and then in the style directory.
foreach ($lineage AS $key => $path) {
$css_file = "/advanced-forum.$key.$css_type";
if (file_exists("$theme_path/$css_file")) {
// If the style specific file is in the theme, use that.
drupal_add_css("$theme_path/$css_file");
}
elseif (file_exists("$path/$css_file")) {
// Otherwise look in the style for it.
drupal_add_css("$path" . "$css_file");
}
}
}
}
advanced_forum_load_style_includes();
}
}
"elseif (file_exists("$path/$css_file")) {"
This wont happen cos there will be double // cos of $css_file = "/advanced-forum.$key.$css_type";
Comments
Comment #1
troky CreditAttribution: troky commentedI am not sure I understand... $theme_path/$css_file and $path/$css_file are different things.
Comment #2
mibfire CreditAttribution: mibfire commented$css_file = "/advanced-forum.$key.$css_type";
$path/$css_file = $path//advanced-forum.$key.$css_type
This is what i mean. There will be double "//"
Comment #3
troky CreditAttribution: troky commentedDouble slashes in file_exists() are ignored.
Comment #4
mibfire CreditAttribution: mibfire commentedso this means file_exists accepts double slashes?
If so, what will be in the following case?
drupal_add_css("$theme_path/$css_file");
Why is there "/" between $theme_path and $css_file?
Comment #5
troky CreditAttribution: troky commentedThere is extra "/" because of bug but that bug doesn't change anything sine // is ignored in both file_exists() and CSS @import url.
Above block should look like:
I will commit change to dev.
Comment #6
mibfire CreditAttribution: mibfire commentedThx