Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: Sir Osis of Liver on June 27, 2022, 11:36:10 PM

Title: $settings['default_theme_url'] is incorrect
Post by: Sir Osis of Liver on June 27, 2022, 11:36:10 PM
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.


Title: Re: $settings['default_theme_url'] is incorrect
Post by: Antechinus on June 28, 2022, 01:08:38 AM
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>';
Title: Re: $settings['default_theme_url'] is incorrect
Post by: Sir Osis of Liver on June 28, 2022, 01:15:52 AM
Will try that, thanks.  I thought theme_default was current 'Overall forum default' in theme settings.
Title: Re: $settings['default_theme_url'] is incorrect
Post by: Arantor on June 28, 2022, 03:17:28 AM
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.
Title: Re: $settings['default_theme_url'] is incorrect
Post by: Antechinus on June 28, 2022, 07:45:15 AM
That's sensible as a starting point. Easy to change if anyone wants to.
Title: Re: $settings['default_theme_url'] is incorrect
Post by: Arantor on June 28, 2022, 07:51:16 AM
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.
Title: Re: $settings['default_theme_url'] is incorrect
Post by: Sir Osis of Liver on June 28, 2022, 05:55:31 PM
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.