Some ideas for styling system in phpBB 4.
I think styles should use tree system without level limitations instead of flat system that phpBB 3 uses. In phpBB 3 template inheritance allows only 1 level deep trees: main style + style that reuses templates. Like this:
- Default style (prosilver)
- - Customized colors (changing colors in css and some images)
- - - Customized header/footer (custom header and footer blocks)
- - - - Custom style <-- this style is available for selection to users
Such tree structure should apply not only to templates, but to everything: css files, scripts, images. There should be some kind of resource manager that handles it.
Each style should have these options:
- Style id
- Style name
- Parent style id
- Flag: if style can be selected
- Extra data: author name, version name, automatic update URL
Requesting any resource would look like this (for example, images/logo.png):
- Client requests styles/custom_style/images/logo.png
- Resource manager checks for that file. If not found, it checks for styles/customized_header/images/logo.png (see sample styles tree above). If not found, it checks for styles/customized_colors/images/logo.png and so on until it reaches main style.
Each resource could be stored in database instead of file system. Storing everything in database would allow scaling forum over multiple servers.
There should be one main style, like prosilver in phpBB 3. It should not be available for editing by administrator. All addons should add their code to that master style via hooks system.
Benefits of such system:
- Different edits could be done in different styles, allowing to easily enable/disable some edits without redoing whole style.
- Forum owner will be able to customize only items that he wants to customize without copying many files.
- It would be easy to roll back to original file, making updating and maintaining styles much easier.
Some styles should not be available for editing:
- Main style.
- Any style that has automatic update URL in meta data (should apply to most downloaded styles).
This would allow updating styles without messing up custom changes.
If resources could be stored in database, there should be multiple ways of accessing resources:
- Via admin control panel.
- Via interface that maps database to file system.
Editing resources remotely
For mapping database to file system a good option is WebDav. It would allow accessing templates from database as if they were usual files, so users could edit templates like in phpBB 3.
Advantages of using system like WebDav:
- Resources would be stored in database, making it easier to run forum on multiple servers.
- It uses its own authentication, so access could be set in admin control panel. People editing files will use their forum credentials to access it. Additional administrators will not have access to FTP.
- Possibility of storing old resources in history, allowing for backup and rollback.
- Easy to track which admin edited resources.