brunoais wrote:^ I quite didn't figure out what you are stating.
You need to be familiar with how template inheritance works in 3.0 to understand this. Then you need to be familiar with other forum systems that use similar functionality and use tree structure for styles to see how it works. Then you need to play with their styling system to appreciate advantages tree system provides.
Example of a styles structure I'm using on one of my client's forums:
- Master Style (main style)
- - Custom Colors (css and images modified via colorizeit)
- - - Template Changes (layout moved around)
- - - - Printing Functionality (includes additional css for "@media print")
- - - - - Banner Ads (only templates that have banners)
- - - - - - Forum Style (final forum style, doesn't include anything)
That forum uses another forum software that supports multiple levels of template inheritance. All styles other than last style are not available for selection by user (similar to deactivated styles in phpbb).
Advantages of doing it:
- Updating forum? I'll just replace master style
- Changing color scheme? I'll just replace "custom colors" style
- Want to customize layout more? I'll edit "template changes" style
- Want to update banner ads? I'll just replace "banner ads" style
I want to give phpBB forum admins ability to do similar stuff.
How much coding does it require to implement? In includes/template/template.php replace functions set_template() and set_custom_template() with this
Code: Select all
public function set_template()
{
$template_name = $this->user->theme['style_path'];
$fallback_name = ($this->user->theme['style_inherits_id']) ? array_reverse(explode('/', $this->user->theme['style_inherit_path'])) : false;
return $this->set_custom_template(false, $template_name, false, $fallback_name);
}
(only 1 line was changed)
Code: Select all
public function set_custom_template($template_path, $template_name, $fallback_template_path = false, $fallback_template_name = false)
{
$templates = array($template_name => $template_path);
if (is_string($fallback_template_name))
{
$templates[$fallback_template_name] = $fallback_template_path;
}
if (is_array($fallback_template_name))
{
$i = 0;
foreach ($fallback_template_name as $fallback_template_name_item)
{
$templates[$fallback_template_name_item] = is_array($fallback_template_path) ? $fallback_template_path[$i] : $fallback_template_path;
$i ++;
}
}
$this->provider->set_templates($templates, $this->phpbb_root_path);
$this->locator->set_paths($this->provider);
$this->locator->set_main_template($this->provider->get_main_template_path());
$this->cachepath = $this->phpbb_root_path . 'cache/tpl_' . str_replace('_', '-', $template_name) . '_';
$this->context = new phpbb_template_context();
return true;
}
(1 line changed, 7 new lines of code)
That's it. Very simple implementation.