You can't just append to one instead of injecting a complete different one? Hint, Nathan does this with his advertisement management mod IIRC.the inability to in-line edit lines of code in template files?
Twig as our template engine
Re: [RFC] Twig as our template engine
Do not hire Christian Bullock he won't finish the job and will keep your money
Re: [RFC] Twig as our template engine
No, that's completely different. Appending code does not solve problem of adding custom HTML code to specific places.RMcGirr83 wrote:You can't just append to one instead of injecting a complete different one? Hint, Nathan does this with his advertisement management mod IIRC.the inability to in-line edit lines of code in template files?
For example, lets take this reply form. What if I want to add new form field before subject? Or maybe after subject? It can't be done by appending code at the end of template, it requires injecting code in middle of existing template.
Other forum software solve that by allowing extensions to replace template code before compiling it and/or before displaying it. Old template engine was designed in such way that it was completely impossible to implement such events. That is a huge problem with template engine that must be solved.
Without it we won't have a modern extensions system. If mod authors will require users to apply manual edits to templates, extensions system fails.
So I also wonder if TWIG implementation can handle it. If not, it is still a major improvement over old template engine but it doesn't improve current extensions engine.
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
What do you mean edit lines of code in template files? Are you talking about editing existing template code, say in overall_header.html, in a template event? If so, not really. Altering existing code is a very difficult problem that doesn't really have any good solution I know of.VSE+ wrote:What I want to know is, does the new TWIG engine (by the way the amount of work you did on this Nathan is awesome) address the biggest limitation of the template system for extension developers: the inability to in-line edit lines of code in template files?
Hopefully, we'll start using blocks in our templates after Twig is merged, which will help make templating much more flexible and cleaner, but that will only be useful in your own template files, not in the phpBB template files.
Altering code is a bit troublesome, not only is it a bit hacky to begin with and prone to errors, but also priority has to be dealt with properly and conflicts can cause huge issues.
Rather than so much static HTML we are better off designing better code from the backend to allow customization rather than require it be done in template files. From Arty's example, if we were using dynamic forms for everything, that would be super easy and wouldn't even require any template code be generated to output, just a single line of PHP to add an element to the form. This is much less likely to cause conflicts and problems than modifying the HTML output.
Re: [RFC] Twig as our template engine
This: https://github.com/nickvergessen/howto- ... phpbb31extEXreaction wrote:Where is that thread?
Everything functions about the same for extensions, except there were some bugs fixed and previously incorrect behavior corrected.
I was on my phone at the time.
Re: [RFC] Twig as our template engine
Yes, for example, say you create an extension, and you want to add a new class to the anchor tags for topic titles in the core template files (i.e.: viewforum.html). There is no way to do that with the extension system. I've had to resort to jQuery in order to pull of certain code injections/manipulations like that, but client-side techniques like that are not always the ideal solution.EXreaction wrote:What do you mean edit lines of code in template files? Are you talking about editing existing template code, say in overall_header.html, in a template event? If so, not really. Altering existing code is a very difficult problem that doesn't really have any good solution I know of.
That would be awesome! If an extension could simply replace existing blocks, that would truly allow extension builders to all the flexibility they had as with the ld MODs systemArty wrote:Other forum software solve that by allowing extensions to replace template code before compiling it and/or before displaying it. Old template engine was designed in such way that it was completely impossible to implement such events. That is a huge problem with template engine that must be solved.
Has an irascible disposition.
Re: [RFC] Twig as our template engine
Replacing block is great but.. what if you want to install 2 extensions which replace the same block. One of them will not work. How will you explain this to not skilled admins? We have similar problem with phpBB Social Network, we replace the old simple profile with extended SN profile, but all modifications like Karma, Medals etc dont work on profile anymore.
Re: [RFC] Twig as our template engine
After checking implementation and twig structure, I think it is possible to add pre-compile event (allowing to change source code before compiling it) and post-display event (allowing to change output). That should solve all problems.
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
Sure, events could be made to do that easily enough, but the real problem is that modifying strings is very prone to errors, especially on template code when there are other extensions or customizations installed. We don't want to add support for hacking code when the only time it will be certain to work is on a completely unmodified board with no other extensions installed. Supporting this would just cause a nightmare for both board owners and extension authors trying to assist them.
Instead of modifying existing HTML through string comparisons at render time, edits should just be made to the code itself to prevent problems and allow the board owner to set it up as their board requires. We're trying to have events wherever reasonable, but we don't expect 100% of alterations to boards to be do-able in extensions (though we can hope for > 99%).
Instead of modifying existing HTML through string comparisons at render time, edits should just be made to the code itself to prevent problems and allow the board owner to set it up as their board requires. We're trying to have events wherever reasonable, but we don't expect 100% of alterations to boards to be do-able in extensions (though we can hope for > 99%).
Re: [RFC] Twig as our template engine
It works very well for all commercial forum packages. Conflicts do happen, but they are extremely rare and almost always caused by add-on author replacing huge blocks of template code without actual need to do so. So if conflicts do happen, it is almost always mod author's fault.
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
What is it exactly that the other forum software does that allows you to modify the HTML? Do you have any examples to show what is being done/how it's being done?