[RFC|Merged] Improved template engine

These requests for comments/change have lead to an implemented feature that has been successfully merged into the 3.1/Ascraeus branch. Everything listed in this forum will be available in phpBB 3.1.
Oleg
Posts: 1150
Joined: Tue Feb 23, 2010 2:38 am
Contact:

Re: [RFC|Accepted] Improved template engine

Post by Oleg »

Continuing with the orig tpl inherits id mess, we have these 4+1 changesets:

r9823 (precursor)
r9839 (fix for 40515/8092)
r9847
r10150 (fix for 51285/8688)
r10460 (fix for 54505/8901)

Reverting the last two of these changesets on develop-olympus brings back bug 8688, and may be a good starting point for writing tests for this whole mess.

Oleg
Posts: 1150
Joined: Tue Feb 23, 2010 2:38 am
Contact:

Re: [RFC|Accepted] Improved template engine

Post by Oleg »

I am sufficiently happy with the state of the template engine to request review and merge. 3rd time is the charm, right?

https://github.com/phpbb/phpbb3/pull/171

https://github.com/p/phpbb3/commit/df46 ... 58dfb98927 makes bbcode engine use the template engine instead of duplicating the latter's code. It required addition of another public implementation function to the template class, and the template engine does a bit more work than bbcode engine needs.

I went through the diff and added documentation everywhere it was missing as well.

Oleg
Posts: 1150
Joined: Tue Feb 23, 2010 2:38 am
Contact:

Re: [RFC|Accepted] Improved template engine

Post by Oleg »

AmigoJack wrote:
Oleg wrote:the template engine expects $this to have template variables, which in the executor/renderer is not the case. Therefore I will be adding a "context" class which will store variables used during template evaluation.
So this issue with the current 3.0.x template system will be resolved then?

Edit: just reviewed the GIT pull for /includes/template/filter.php and still see the old behaviour on line 449. :( My main interest is to use properties instead of variables everywhere in the rendered PHP code, so scope limitations won't affect file inclusions anymore. Thus included template files can also reference loop (template) variables, like {postrow.POST_ID}.
I agree with Nils:
naderman wrote:That does seem like a useful improvement. Changing the semantics for 3.0 is probably not a good idea, but we should get this into 3.1.
However, I think this feature is not as important as hooks, and right now the template engine RFC will be merged without it.

Oleg
Posts: 1150
Joined: Tue Feb 23, 2010 2:38 am
Contact:

Re: [RFC|Merged] Improved template engine

Post by Oleg »

Template engine has been merged. Further changes should go into separate tickets and/or RFCs.

Post Reply