MyStudio's core idea: a theme's files are the truth, and MyBB's database is a cache. You edit files, MyStudio copies them into MyBB (a sync), and MyBB renders the forum as it always has.
- One template = one
.htmlfile; stylesheets are listed intheme.json - No PHP in themes: theme PHP lives in
inc/plugins/mystudio/themes/{slug}/ - New files and
theme.jsonchanges need a full sync
Files first, database second
You edit files Sync MyBB reads the database
┌──────────────────┐ ┌──────────┐ ┌───────────────────────────────┐
│ themes/my-theme/ │ ─▶ │ MyStudio │ ─▶ │ templates, stylesheets, theme │ ─▶ your forum
└──────────────────┘ └──────────┘ └───────────────────────────────┘
If the files and the database ever disagree, the files win: the next sync puts the database right. Because MyBB still reads its own tables, every MyBB feature, hook, template variable and plugin keeps working.
What a theme folder holds
themes/mystudio-default/
├── theme.json name, version, parent, stylesheets, modules, supports …
├── default.json saved setting values (written by the Admin CP)
├── screenshot.jpg 1280 × 800, shown on the Themes page
├── css/ stylesheets (listed in theme.json)
├── templates/
│ ├── header/header.html → MyBB template "header"
│ ├── forumdisplay/forumdisplay_thread.html
│ └── ungrouped/headerinclude.html
├── js/ scripts, loaded from here by templates
├── images/ theme images, logos
└── vendor/ third-party files (Bootstrap, Bootstrap Icons)
- One template = one
.htmlfile, named after the MyBB template.header.htmlisheader. - Sub-folders are only for tidiness. MyBB doesn't care which folder a template is in.
- Stylesheets must be listed in
theme.json, with where they load (every page, or chosen scripts). See the theme.json reference.
Where PHP lives (never in the theme)
Themes contain no PHP. Anything in themes/ could arrive in an uploaded ZIP, and an uploaded theme must never run code. When a theme needs PHP, it lives in fixed places outside the theme:
| What | Where |
|---|---|
| Theme hooks (PHP that runs on every page) | inc/plugins/mystudio/themes/{slug}/hooks.php |
| Page shell and sidebar helpers | inc/plugins/mystudio/themes/{slug}/layout.php |
| Settings schema | inc/plugins/mystudio/themes/{slug}/options.php |
| Language strings | inc/plugins/mystudio/themes/{slug}/lang/{language}/*.lang.php |
| Features for every theme | Modules: inc/plugins/mystudio/modules/{id}/ |
The .htaccess files in themes/ and inc/plugins/mystudio/ only let assets (CSS, JS, images, fonts) through to browsers.
When to sync
| You changed… | What to do |
|---|---|
| An existing template or stylesheet in the Admin CP editor | Nothing: Ctrl+S updates MyBB at once. |
| An existing file in your own editor or by FTP | Sync (Themes page, the editor's sync button, or cli.php sync). |
| Added a new template or stylesheet | A full sync: quick saves only update files MyBB already knows. |
theme.json | A full sync. |
| Theme PHP (hooks, language files) | Nothing: PHP is read on every page. |
During development, turn on auto-sync in Dev Options: save in your editor and the forum syncs and reloads by itself.
What a sync does
- Reads the theme (and, for a child theme, its whole parent chain), builds the complete theme and imports it with MyBB's own theme importer. Changed templates get an incremental update.
- Checks every template with MyBB's template security check and refuses anything that could run PHP.
- Writes the compiled CSS to
cache/themes/; JS stays in the theme'sjs/folder. - Re-syncs the theme's child themes.
It also works the other way: a theme that only exists in the database can be extracted to files with Convert to Disk.
Settings live outside the theme files
| Settings | Stored in |
|---|---|
| Theme settings (colour, logo …) | The theme's default.json; schema in options.php |
| MyStudio Options (layout, header, sidebar …) | The database, per theme |
| Module settings | The database, shared by all themes |
So updates can replace a shipped theme's files without losing anyone's settings.
Why files make theme building easier
postbit_classic lives.Next: create your own theme.