MyBB Community Forums

Full Version: Allow to use flat file for theme development
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
May I suggest for the new MyBB to be able to work with flat files and bypass cache and database for *both* stylesheets and templates.

I am new to MyBB. With 1.8.6 I couldn't find a way to efficiently work on a custom theme. I asked in the theme development forum for a solution and the only thing that was suggested is a modification, which also works only for Sublime Text editor. So I ended up hacking css.php to bypass the cache if I have a flat file present in a theme/ folder. .. and that takes care only of the stylesheets.

Backups 
So I am still left with templates in the database. So everytime I do backups of my Git repo..  all the work I put in the large selection of templates... is potentially lost if I make a mistake and replace my local database (which is a likely event, since it is just a test database for trying out plugins and the like). Thus I have to make sure to remember to export the templates table. Export via admin is not an option, because that's slow and manual. So I have to add mysqldump to my backup script to make sure I don't lose my templates work if I don't pay attention.

Inefficient
There really ought to be a better way for experienced developers and designers to work with flat files for both stylesheets and templates. There are so many templates and I am new to MyBB therefore to learn my way around I have to search a lot. Since I don't have access to flat files, I have to use mysql queries in order to find out if a string exists in this or that template. I can't use my usual search tools (Terminal+grep, or your typical "search in folder" GUI of your text editor of choice).

Collaboration
Say I want to put the custom theme for my forum on github, and allow users to make tweaks here and there. How do I do that? I don't want to give them direct access to the admin or live template. But I'd like to let them suggest changes, or create a variant of the theme (eg. a dark theme, if I only made a light one), that I can import later after I reviewed it.

Now one issue I can see is that there are so many templates. But honestly I'd still rather work with a folder with hundreds of template files, then nothing at all (since they are named rather consistently, that helps a lot navigate them).

I'd suggest a method similar to the modding of games such as Skyrim : have a setting in admin that enable the use of flat files; If file is present in theme folder, use it and ignore the cache (something like this with a mod_rewrite rule). And add a button to "import" the flat files into the database. Once you go in production you 1) import the flat files 2) disable the "use of flat files" and that's it.
MyBB 2.0 uses Twig which uses flat files. Templates won't be stored in the database.
Ahh that is great news, thanks!