SMF Development > Next SMF Discussion

[3.0] Redo the theme system for SMF (2.1+ obviously)

<< < (3/7) > >>

live627:

--- Quote ---You can already do this. If you don't modify a template file, don't include it in the theme directory. SMF will use the template file from the "default" directory in this case.

Most simple themes will only need to include index.template.php. If they only touch the CSS and images, they won't need to include any template file.
--- End quote ---
I know... but I'm not talking about individual files (templates). I'm talking about the specific functions (sub templates).


--- Quote ---Not sure what you mean or how that would work.
--- End quote ---
It's not an entirely new concept, for template layers can do much the same thing. But this... this is like the middle of the sandwich, whilst layers use above and below  like the bread on a sandwich.

Let's go a bit deeper. Currently, you have $context['sub_template'] = 'mst';, which only allows for one sub template at a time. So let's expand on that and get $context['sub_templates'] = array('mst', 'display;');. With an appropriate edit to obExit(), multiple sub templates may be used per page!

青山 素子:

--- Quote from: live627 on September 20, 2011, 08:29:27 PM ---I know... but I'm not talking about individual files (templates). I'm talking about the specific functions (sub templates).

--- End quote ---

That would be interesting due to how PHP handles function declarations. You'd need to protect each function using a "function_exists" call to avoid declaring it twice and causing PHP to throw an error. Such a situation could get very messy.


--- Quote from: live627 on September 20, 2011, 08:29:27 PM ---Let's go a bit deeper. Currently, you have $context['sub_template'] = 'mst';, which only allows for one sub template at a time. So let's expand on that and get $context['sub_templates'] = array('mst', 'display;');. With an appropriate edit to obExit(), multiple sub templates may be used per page!

--- End quote ---

How would that work in practice? I can't think of a practical example of this, but I'm sure you could.

Oldiesmann:

--- Quote from: live627 on September 20, 2011, 08:29:27 PM ---I know... but I'm not talking about individual files (templates). I'm talking about the specific functions (sub templates).

--- End quote ---

I really don't see how that could work well, short of splitting every sub-template into its own file (which would be a nightmare). Even if you use "custom_" prefix, there's a possibility of getting errors if the theme that yours is based on has also customized that particular sub-template (not likely, but it could happen).

DoctorMalboro:
HTML5BP + Template system = Win

I think SMF MUST do a big step foward in the design, is the only thing that has been left behind and now it's a good time to catch up. The main design is not bad, but maybe creating a better templating will make new themes better and more creative.

bloc:
I don't think its ever been the lack of creative forces? Its just that mods decide what templates we can change(or have up until now anyway) and that the themesystem is maybe too complex at first glance. IMHO thats good thing, the complexity..also, one thing that perhaps is the BIGGEST obstacle in new creative looks for SMF, is that forum owners are *very* traditional. Very few like to change that lovely table/spreadsheet/box layout we have been using for years. Heck, even Curve had a lot of resistance, and that just added a few more rounded headers and containers - its still essentially the same layout as 1.1.


--- Quote from: live627 on September 20, 2011, 08:29:27 PM ---
--- Quote ---You can already do this. If you don't modify a template file, don't include it in the theme directory. SMF will use the template file from the "default" directory in this case.

Most simple themes will only need to include index.template.php. If they only touch the CSS and images, they won't need to include any template file.
--- End quote ---
I know... but I'm not talking about individual files (templates). I'm talking about the specific functions (sub templates).


--- Quote ---Not sure what you mean or how that would work.
--- End quote ---
It's not an entirely new concept, for template layers can do much the same thing. But this... this is like the middle of the sandwich, whilst layers use above and below  like the bread on a sandwich.

Let's go a bit deeper. Currently, you have $context['sub_template'] = 'mst';, which only allows for one sub template at a time. So let's expand on that and get $context['sub_templates'] = array('mst', 'display;');. With an appropriate edit to obExit(), multiple sub templates may be used per page!

--- End quote ---

I think I follow your thoughts..but this doesn't really make it better to theme, it just moves things around. If you cannot change the whole template out of fear it will not work with mods, you have already lost.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version