$settings['default_theme_url'] is incorrect

Started by Sir Osis of Liver, June 27, 2022, 11:36:10 PM

Previous topic - Next topic

Sir Osis of Liver

Running id_theme = 9 in 2.0.19, theme_default = 1, theme_guests = 9.  repair_settings does not correct theme_default, changed it manually to theme_default = 9, $settings['default_theme_url'] is still /Themes/default.  Seeing same thing in clean 2.0.19 install.  Causing a problem with Arantor's Tidy Child Boards mod -


<link rel="stylesheet" type="text/css" href="' . $settings['default_theme_url'] . '/css/tidychildboards2.css?fin20" />
<style type="text/css">.tidy_child { width:' . floor(90/$modSettings['tidy_child_boards']) . '%; }</style>';


Won't load tidychildboards2.css from theme css, only from Curve.


"The best laid schemes o' mice an' men / Gang aft a-gley." - Robert Burns

Antechinus

Obviously. That's what this means:
<link rel="stylesheet" type="text/css" href="' . $settings['default_theme_url'] . '/css/tidychildboards2.css?fin20" />
The default theme is Curve (theme id = 1).
If you want it to load from the current theme...
<link rel="stylesheet" type="text/css" href="' . $settings['theme_url'] . '/css/tidychildboards2.css?fin20" />
<style type="text/css">.tidy_child { width:' . floor(90/$modSettings['tidy_child_boards']) . '%; }</style>';

Sir Osis of Liver

Will try that, thanks.  I thought theme_default was current 'Overall forum default' in theme settings.
"The best laid schemes o' mice an' men / Gang aft a-gley." - Robert Burns

Arantor

That was deliberate on my part in the mod so you didn't get many duplicates of the CSS file, or if people didn't install it into different themes in the package manager, it'd still work.

Antechinus

That's sensible as a starting point. Easy to change if anyone wants to.

Arantor

And to answer Sir Osis's implied question, default_theme_dir and default_theme_url *always* point at Themes/default (one has the full path, the other the full URL) so that for themes that don't supply a full list of templates or whatever, it has the correct location to fall back to.

theme_dir and theme_url are always "visitor's current theme" even if that is also the default theme.

Sir Osis of Liver

Ant's fix worked. :)   I usually move template, css, language files, anything that's changed (except sources) into theme directory so it's all in one place. Working on a clone on my server, makes it easier to move to production site and do followup if it's all together.
"The best laid schemes o' mice an' men / Gang aft a-gley." - Robert Burns

Advertisement: