Even without the change to twig (What, like Nathan said, support the old phpBB syntax) you wont be able to use 3.0 MODs in most cases. MODs like in phpBB3 should not exists anymore in 3.1, they should be rewritten to extensions instead.*Daniel wrote:Guys,
Didn't you say that you were going to make phpBB 3.1 so that we can use mods written for phpBB 3.0? If you move to this new framework then we are going to be *beep* as there many changes that would be required.
What happen to backward compatibility?
No wonder why people are moving away or won't be upgrading.
Twig as our template engine
Re: [RFC] Twig as our template engine
Re: [RFC] Twig as our template engine
As you might have noticed, EXreaction said that he's currently writing code to support the current phpBB syntax which also means that backwards compatibility is mainly preserved.*Daniel wrote:Guys,
Didn't you say that you were going to make phpBB 3.1 so that we can use mods written for phpBB 3.0? If you move to this new framework then we are going to be *beep* as there many changes that would be required.
What happen to backward compatibility?
No wonder why people are moving away or won't be upgrading.
Re: [RFC] Twig as our template engine
Template system for 3.1 was not designed to be extendable, it can't even handle extensions properly and its abstraction makes it look like it was designed that way for sake of creating multiple classes, not for benefit of anyone.
So move to twig is the best thing that can happen to phpBB. Twig already includes all functionality that current template system lacks and later can be used to switch from old smarty-like template system to twig system used by many projects.
So move to twig is the best thing that can happen to phpBB. Twig already includes all functionality that current template system lacks and later can be used to switch from old smarty-like template system to twig system used by many projects.
Formerly known as CyberAlien.
Free phpBB styles | Premium responsive XenForo styles | Iconify - modern open source replacement for glyph fonts
Free phpBB styles | Premium responsive XenForo styles | Iconify - modern open source replacement for glyph fonts
- EXreaction
- Registered User
- Posts: 1555
- Joined: Sat Sep 10, 2005 2:15 am
Re: [RFC] Twig as our template engine
I believe the PR for this has been mostly completed. The only issue remaining is that some of the functional tests are failing, though for what reason, I am not sure.
There is a lot of code that can be cleaned up still related to the styles/template system, but I'm going to leave those for later as it works as-is and I wish to keep this PR as small as possible.
With the Twig PR, the only syntax that has changed slightly is the INCLUDEJS, no longer is it only limited to a path within the style tree (can use @namespace to include files also) and no longer do you need to append template/ to the path. INCLUDEJS was not in 3.0, so this does not break any compatibility.
All of the functionality of Twig is able to be used now as well (all tags, filters, functions, and operators) using the standard Twig tokens {% %}, {{ }}. Some of this functionality is now also available in phpBB syntax (e.g. <!-- IF loop|length > 3 -->). You cannot use Twig only functionality (e.g. for) using phpBB open/close tags (e.g. <!-- for item in items -->) as only existing phpBB template tags are transformed to Twig functionality.
See http://twig.sensiolabs.org/doc/templates.html for more information on how to use Twig syntax.
When Twig is merged, I will try to get around to a new templating guide explaining how to use Twig syntax as well (though the Twig documentation is very good already).
There is a lot of code that can be cleaned up still related to the styles/template system, but I'm going to leave those for later as it works as-is and I wish to keep this PR as small as possible.
With the Twig PR, the only syntax that has changed slightly is the INCLUDEJS, no longer is it only limited to a path within the style tree (can use @namespace to include files also) and no longer do you need to append template/ to the path. INCLUDEJS was not in 3.0, so this does not break any compatibility.
All of the functionality of Twig is able to be used now as well (all tags, filters, functions, and operators) using the standard Twig tokens {% %}, {{ }}. Some of this functionality is now also available in phpBB syntax (e.g. <!-- IF loop|length > 3 -->). You cannot use Twig only functionality (e.g. for) using phpBB open/close tags (e.g. <!-- for item in items -->) as only existing phpBB template tags are transformed to Twig functionality.
See http://twig.sensiolabs.org/doc/templates.html for more information on how to use Twig syntax.
When Twig is merged, I will try to get around to a new templating guide explaining how to use Twig syntax as well (though the Twig documentation is very good already).
Re: [RFC] Twig as our template engine
And coding guidelines will need adjusting detailing which to use in which cases?
Formerly known as Unknown Bliss
No unsolicited PMs please except for quotes.psoTFX wrote: I went with Olympus because as I said to the teams ... "It's been one hell of a hill to climb"
- imkingdavid
- Registered User
- Posts: 1050
- Joined: Thu Jul 30, 2009 12:06 pm
Re: [RFC] Twig as our template engine
For consistency, it might be good to look into masking twig functions with our own syntax (for instance, what you did with INCLUDEJS) so that we don't have two syntaxes in the same file. It's more work, but would help save some confusion.
- EXreaction
- Registered User
- Posts: 1555
- Joined: Sat Sep 10, 2005 2:15 am
Re: [RFC] Twig as our template engine
That would be one option, it would just be a simple regular expression to setup masks for all the twig tags.
I would need to tweak some of my existing regular expressions to support filters and stuff, as well as make tests for all of it.
I would need to tweak some of my existing regular expressions to support filters and stuff, as well as make tests for all of it.
- EXreaction
- Registered User
- Posts: 1555
- Joined: Sat Sep 10, 2005 2:15 am
Re: [RFC] Twig as our template engine
Alright, I've done all that except for the testing part. Can now use all the Twig tokens as <!-- uppercase(twig token) -->. E.g. <!-- BLOCK foo -->
Can also use filters in our variable tags. E.g. {SITENAME|lower}
Can also use filters in our variable tags. E.g. {SITENAME|lower}
- EXreaction
- Registered User
- Posts: 1555
- Joined: Sat Sep 10, 2005 2:15 am
Re: [RFC] Twig as our template engine
All tests are now passing on this PR.
Re: [RFC] Twig as our template engine
Good work. So know phpbb has 2 template engines? Or have you removed the old one and added Twig + syntax from old engine on top of Twig?