Template inheritance feedback.

Discuss features as they are added to the new version. Give us your feedback. Don't post bug reports, feature requests, support questions or suggestions here.
Forum rules
Discuss features as they are added to the new version. Give us your feedback. Don't post bug reports, feature requests, support questions or suggestions here. Feature requests are closed.
Post Reply
User avatar
PayBas
Registered User
Posts: 305
Joined: Tue Jul 29, 2008 6:08 pm
Contact:

Template inheritance feedback.

Post by PayBas »

At the moment I am working on a rather large styling project for phpBB which relies heavily on phpBB 3.0.3 template inheritance. I actually released a beta a few days ago which requires 3.0.3 RC1 because of it. For more info look here: http://www.phpbb.com/community/viewtopi ... &t=1008155

Now, one of the biggest problem (or annoyances if you will) with TI (template inheritance) is the following:
In the implementation for 3.0 there are a few limitations to this, which we won’t keep secret. For starters, there is no stacking of fallbacks. It’s only possible to fallback to a template that does not itself declare to be dependent on another template. The other major limitation is that it only affects the files managed by the template engine (*.html) and not the static javascript files bundled with many templates. Those static files still have to be copied, or manually linked using the new {T_SUPER_TEMPLATE_PATH} template variable.
Let's say you have a super/master style and 7 styles that inherit from it. At the moment, that means that you will have to copy all the .js files used by the styles to each and every style folder or copy the template calling for the .js file from the super style and put it in each of the inheriting style's template directories and then changing all {T_TEMPLATE_PATH} into {T_SUPER_TEMPLATE_PATH}.

So, either way, you're going to have to create a lot of (somewhat) duplicate files... which is exactly what TI set out to fix in the first place, right?


My suggestion:
Make the super style accept {T_SUPER_TEMPLATE_PATH}. At the moment, it simply ignores it, or at least doesn't do anything usefull with it. If phpBB could check each time it finds {T_SUPER_TEMPLATE_PATH} in the code if the style actually HAS a super style, and if not, change it to {T_TEMPLATE_PATH} then it would fix the whole problem I think. Then we won't have to duplicate all the .js or copy all kinds of templates (and thus exclude them from TI) just because we have to change 1 or 2 lines in them.
User avatar
Kellanved
Former Team Member
Posts: 407
Joined: Sun Jul 30, 2006 4:59 pm
Location: Berlin

Re: Template inheritance feedback.

Post by Kellanved »

I have changed the template path assignment. However, a template-level switch would have worked as well, i.e.

Code: Select all

<!-- IF T_SUPER_TEMPLATE_PATH -->
   ... do something with the super template's files ...
<!-- ELSE -->
   ... do something else 
<!-- ENDIF -->
No support via PM.
Trust me, I'm a doctor.
User avatar
PayBas
Registered User
Posts: 305
Joined: Tue Jul 29, 2008 6:08 pm
Contact:

Re: Template inheritance feedback.

Post by PayBas »

At the moment that doesn't work because even if there is no super template, it will still out a string like:

Code: Select all

.styles//template
Of course I could change the whole thing to:

Code: Select all

<!-- IF T_SUPER_TEMPLATE_PATH eq '.styles//template' -->
But that is very ugly.
User avatar
PayBas
Registered User
Posts: 305
Joined: Tue Jul 29, 2008 6:08 pm
Contact:

Re: Template inheritance feedback.

Post by PayBas »

Just did some testing and when changing (in functions.php):

Code: Select all

		'T_SUPER_TEMPLATE_PATH'	=> (isset($user->theme['template_inherit_path'])) ? "{$phpbb_root_path}styles/" . $user->theme['template_inherit_path'] . '/template' : '',
To:

Code: Select all

		'T_SUPER_TEMPLATE_PATH'	=> ((isset($user->theme['template_inherit_path'])) && ($user->theme['template_inherit_path'] !== '')) ? "{$phpbb_root_path}styles/" . $user->theme['template_inherit_path'] . '/template' : '',
it works fine.
Post Reply