Currently phpBB 3.1 supports both old phpBB template syntax and TWIG syntax. There are issues with phpBB template syntax because it is very different from what TWIG was designed for. Almost ("almost" because I'm not sure about INCLUDEJS) every keyword can be easily converted to TWIG format.
I suggest to start gradually switching from phpBB template syntax to TWIG in template files with eventual goal to completely abandon phpBB template syntax in future.
[RFC] Gradually switch to TWIG template syntax
- EXreaction
- Registered User
- Posts: 1555
- Joined: Sat Sep 10, 2005 2:15 am
Re: [RFC] Gradually switch to TWIG template syntax
This would have a few big advantages and disadvantages.
+ Once everything were to be moved over, we can greatly simplify the template engine and remove all the complex parsing that is done to transform our code to Twig
+ Using all Twig code would make it easier for users; it's better documented, more universally used/supported
- Moving over completely isn't something that's realistically likely to happen in either prosilver or subsilver2
- Users will probably be quite confused when they run into the two different types of syntax
Those items being said, I'm not sure whether transitioning to Twig syntax in our existing templates is a good idea due to the confusion our users will likely have.
If a new style were to be made for 3.x, I would definitely support using all Twig syntax in it and deprecating our old syntax.
+ Once everything were to be moved over, we can greatly simplify the template engine and remove all the complex parsing that is done to transform our code to Twig
+ Using all Twig code would make it easier for users; it's better documented, more universally used/supported
- Moving over completely isn't something that's realistically likely to happen in either prosilver or subsilver2
- Users will probably be quite confused when they run into the two different types of syntax
Those items being said, I'm not sure whether transitioning to Twig syntax in our existing templates is a good idea due to the confusion our users will likely have.
If a new style were to be made for 3.x, I would definitely support using all Twig syntax in it and deprecating our old syntax.
- Pony99CA
- Registered User
- Posts: 986
- Joined: Sun Feb 08, 2009 2:35 am
- Location: Hollister, CA
- Contact:
Re: [RFC] Gradually switch to TWIG template syntax
I agree with EX. "Gradually" switching over seems like it would be more confusing, even if done one template file at a file. If you plan to convert existing styles, the whole style should be done at once (if possible).
Steve
Steve
Silicon Valley Pocket PC (http://www.svpocketpc.com)
Creator of manage_bots and spoof_user (ask me)
Need hosting for a small forum with full cPanel & MySQL access? Contact me or PM me.
Creator of manage_bots and spoof_user (ask me)
Need hosting for a small forum with full cPanel & MySQL access? Contact me or PM me.
Re: [RFC] Gradually switch to TWIG template syntax
agree a new template built from twig would be a better and probably faster approach anyway. The question then becomes how long do we support the others? and do we continue to update their codebase to be more modern or just add enhancements?
Re: [RFC] Gradually switch to TWIG template syntax
I agree, creating a new style using TWIG exclusively would make more sense to me. Would also give style designers a new base to work off.
- EXreaction
- Registered User
- Posts: 1555
- Joined: Sat Sep 10, 2005 2:15 am
Re: [RFC] Gradually switch to TWIG template syntax
We would probably continue to support the old syntax for a few years/versions after we switch to only Twig syntax in a release.
The entire prosilver style could be switched to Twig syntax relatively easily too using some mass search/replace (could be done with a script so everyone could run it and update their styles). If this is something we'd like to do, it could be done for 3.2.
The entire prosilver style could be switched to Twig syntax relatively easily too using some mass search/replace (could be done with a script so everyone could run it and update their styles). If this is something we'd like to do, it could be done for 3.2.
Re: [RFC] Gradually switch to TWIG template syntax
Why not Smarty? Twig is too slow. See this article.
- EXreaction
- Registered User
- Posts: 1555
- Joined: Sat Sep 10, 2005 2:15 am
Re: [RFC] Gradually switch to TWIG template syntax
That article is extremely old and was tested with recent builds from that time period. A more recent test shows Twig is actually significantly faster:
http://sapphirepaw.blogspot.com/2013/08 ... art-1.html
But then again, I don't typically trust benchmarks found online; they are typically not done in a controlled enough environment to get really accurate results, not to mention benchmarks rarely use real life examples which are far more important than a small benchmark that doesn't have a lot of coverage of feature usage. Just because one is faster at one thing doesn't mean that it will overall be faster on average.
We've already switched our template engine to Twig; Smarty just doesn't have the same feature set that Twig does and didn't meet our needs.
http://sapphirepaw.blogspot.com/2013/08 ... art-1.html
But then again, I don't typically trust benchmarks found online; they are typically not done in a controlled enough environment to get really accurate results, not to mention benchmarks rarely use real life examples which are far more important than a small benchmark that doesn't have a lot of coverage of feature usage. Just because one is faster at one thing doesn't mean that it will overall be faster on average.
We've already switched our template engine to Twig; Smarty just doesn't have the same feature set that Twig does and didn't meet our needs.
- nickvergessen
- Former Team Member
- Posts: 733
- Joined: Sun Oct 07, 2007 11:54 am
- Location: Stuttgart, Germany
- Contact:
Re: [RFC] Gradually switch to TWIG template syntax
I'm also against changing prosilver to a different syntax.
We agreed switching to twig with the condition to keep the current syntax, so users are not bugged with it.
We agreed switching to twig with the condition to keep the current syntax, so users are not bugged with it.
Member of the Development-Team — No Support via PM
Re: [RFC] Gradually switch to TWIG template syntax
Ok so when will be twig actually used?
Many SW changed their template engine, yes it was confusing at first and some difficulties occurred, but thats the progress. Moreover, those softwares had only one template engine syntax, phpBB 3.1 will support both, new and old one. I personally would use twig in prosilver 3.1 without hesitating.
Many SW changed their template engine, yes it was confusing at first and some difficulties occurred, but thats the progress. Moreover, those softwares had only one template engine syntax, phpBB 3.1 will support both, new and old one. I personally would use twig in prosilver 3.1 without hesitating.