Forums | Mahara Community

Developers /
stylesheet inheritance from parent themes


anonymous profile picture
Account deleted
Posts: 16

21 June 2009, 15:26

Our LeaderTracker project is still on 1.1 Stable (as modified for our project) and LeaderTracker theme is set to the parent "default".

In working on some mods for view editing pages ... I've noticed ... UNLIKE style.css ... that the "views.css" is an either/or ... that is, if I put an overriding views.css into the leadertracker theme then it will only take that css and NOT put in the parent theme css.

 I've made the following change to the web.php to fix it so that it behaves the same ... loading the parent theme stylesheets and then the children stylesheets of the same name

---------------- NEW CODE SNIPPET (web.php approx line 323) ----------------------

    // look for extra stylesheets
    if (isset($extraconfig['stylesheets']) && is_array($extraconfig['stylesheets'])) {
        foreach ($extraconfig['stylesheets'] as $extrasheet) {
            if ($more_sheets = (array)theme_get_url($extrasheet, null, true)) {
                $stylesheets = array_merge($stylesheets, array_reverse($more_sheets));
            }
        }
    }
   
    // look for browser specific stylesheet adjustments
    require_once(get_config('docroot') . 'lib/php_browser_detection/browser_detection.php');
    if ($currentbrowserinformation = browser_detection('full')) {
        if (($currentbrowserinformation[7] == 'msie') && ($currentbrowserinformation[9] <= 6)) {
            if ($more_sheets = (array)theme_get_url('style/ie6_fixes.css', null, true)) {
                $stylesheets = array_merge($stylesheets, array_reverse($more_sheets));
            }
        }
    }

------------------- REPLACES previous code as follows: ----------------------

     // look for extra stylesheets
     if (isset($extraconfig['stylesheets']) && is_array($extraconfig['stylesheets'])) {
         foreach ($extraconfig['stylesheets'] as $extrasheet) {
            if ($sheet = theme_get_url($extrasheet)) {
                $stylesheets[] = $sheet;
             }
         }
     }
    
     // look for browser specific stylesheet adjustments
     require_once(get_config('docroot') . 'lib/php_browser_detection/browser_detection.php');
     if ($currentbrowserinformation = browser_detection('full')) {
         if (($currentbrowserinformation[7] == 'msie') && ($currentbrowserinformation[9] <= 6)) {
            if ($sheet = theme_get_url('style/ie6_fixes.css')) {
                $stylesheets[] = $sheet;
             }
         }
     }
 

anonymous profile picture
Account deleted
Posts: 1643

21 June 2009, 20:13

Hi Ray - FYI, I've fixed this in Mahara 1.2 already (we found the problem independently of you), though I didn't backport the fix. Do you care if the fix is backported to 1.1? If not I might just ignore it.

PS: the browser detection stuff - that looks like it's your own custom code, Mahara doesn't do anything like that Wink

2 results