[3.1][3.2][RC] Twig Converter

A place for Extension Authors to post and receive feedback on Extensions still in development. No Extensions within this forum should be used within a live environment!
Scam Warning
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: Extensions Development rules

IMPORTANT FOR NEEDED EVENTS!!!
If you need an event for your extension please read this for the steps to follow to request the event(s)
hubaishan
Translator
Posts: 113
Joined: Sun Apr 10, 2011 2:47 pm
Name: Saeed Hubaishan
Contact:

Re: [3.1][3.2][RC] Twig Converter

Post by hubaishan » Wed Nov 08, 2017 2:14 pm

Why twig?!
What can twig do, phpBB template can't?

User avatar
david63
Jr. Extension Validator
Posts: 13899
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Name: David Wood
Contact:

Re: [3.1][3.2][RC] Twig Converter

Post by david63 » Wed Nov 08, 2017 4:06 pm

hubaishan wrote:
Wed Nov 08, 2017 2:14 pm
Why twig?!
What can twig do, phpBB template can't?
Basically so that the phpBB team do not have to maintain the templating framework and can concentrate on working on the core.
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored

User avatar
RMcGirr83
Recognised Extension Developer
Posts: 20762
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr
Contact:

Re: [3.1][3.2][RC] Twig Converter

Post by RMcGirr83 » Fri Dec 15, 2017 1:48 pm

hubaishan wrote:
Wed Nov 08, 2017 2:14 pm
Why twig?!
What can twig do, phpBB template can't?
Have a read as to why.
In times of change, learners inherit the earth, while the learned find themselves beautifully equipped to deal with a world that no longer exists - Eric Hoffer
Former Modifications/Extensions Team Member | My extensions
Appreciate the extensions/mods/support then buy me a beer
All requests for support via PM will be ignored

User avatar
kasimi
Extension Customisations
Extension Customisations
Posts: 2644
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany
Contact:

Re: [3.1][3.2][RC] Twig Converter

Post by kasimi » Fri Dec 15, 2017 4:17 pm

MarkDHamill wrote:
Fri Dec 15, 2017 12:47 pm
The messenger class uses template tags that go in the /language/en/email folder, so extensions that do emailing like mine must create them in our extensions. In 3.0 it was not as sophisticated as the full templating system. You could not use loops, for example. Perhaps this is no longer the case.

It wasn't a big deal to convert my language files so I did it manually, but you might want to add it to the files to convert.
The latest commit on master adds this feature. Could you test it when you have a moment?

User avatar
Stoker 4.0
Registered User
Posts: 1478
Joined: Sun Feb 13, 2011 1:33 pm
Location: Funen, Denmark
Name: Ulrik Christensen
Contact:

Re: [3.1][3.2][RC] Twig Converter

Post by Stoker 4.0 » Sat Jan 20, 2018 3:51 pm

Version 1.2.0 trying to convert prosilver and get this error.

Code: Select all

Fatal error: Uncaught Error: Class 'ZipArchive' not found in /var/www/vhosts/phpbb3bbcodes.com/httpdocs/ext/kasimi/twigconverter/controller/main.php:276 Stack trace: #0 /var/www/vhosts/phpbb3bbcodes.com/httpdocs/ext/kasimi/twigconverter/controller/main.php(240): kasimi\twigconverter\controller\main->make_zip('./../store/', 'prosilver_twig_...', Array) #1 /var/www/vhosts/phpbb3bbcodes.com/httpdocs/ext/kasimi/twigconverter/controller/main.php(120): kasimi\twigconverter\controller\main->run('prosilver', Array) #2 /var/www/vhosts/phpbb3bbcodes.com/httpdocs/ext/kasimi/twigconverter/acp/main_module.php(28): kasimi\twigconverter\controller\main->convert('./../adm/index....') #3 /var/www/vhosts/phpbb3bbcodes.com/httpdocs/includes/functions_module.php(676): kasimi\twigconverter\acp\main_module->main('\\kasimi\\twigcon...', 'convert') #4 /var/www/vhosts/phpbb3bbcodes.com/httpdocs/adm/index.php(82): p_master->load_active() #5 {main} thrown in /var/www/vhosts/phpbb3bbcodes.com/httpdocs/ext/kasimi/twigconverter/controller/main.php on line 276

User avatar
kasimi
Extension Customisations
Extension Customisations
Posts: 2644
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany
Contact:

Re: [3.1][3.2][RC] Twig Converter

Post by kasimi » Sat Jan 20, 2018 3:57 pm

Your PHP installation is missing the ZIP extension: https://stackoverflow.com/questions/387 ... t-found-in

User avatar
Stoker 4.0
Registered User
Posts: 1478
Joined: Sun Feb 13, 2011 1:33 pm
Location: Funen, Denmark
Name: Ulrik Christensen
Contact:

Re: [3.1][3.2][RC] Twig Converter

Post by Stoker 4.0 » Sat Jan 20, 2018 4:12 pm

kasimi wrote:
Sat Jan 20, 2018 3:57 pm
Your PHP installation is missing the ZIP extension: https://stackoverflow.com/questions/387 ... t-found-in
Thanks, found it and installed it. Now it works ;)

User avatar
kasimi
Extension Customisations
Extension Customisations
Posts: 2644
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany
Contact:

Re: [3.1][3.2][RC] Twig Converter

Post by kasimi » Sat Jan 20, 2018 4:20 pm

I added an ext.php that checks for this: https://github.com/kasimi/phpbb-ext-twi ... 79d338fd10

User avatar
Stoker 4.0
Registered User
Posts: 1478
Joined: Sun Feb 13, 2011 1:33 pm
Location: Funen, Denmark
Name: Ulrik Christensen
Contact:

Re: [3.1][3.2][RC] Twig Converter

Post by Stoker 4.0 » Sat Jan 20, 2018 4:25 pm

Dont know if anybody else can use this guide to install zip in ubuntu. Worked for me and its simple:
https://www.digitalocean.com/community/ ... -in-ubuntu

nou nou
Registered User
Posts: 157
Joined: Sat Oct 29, 2016 8:08 pm

Re: [3.1][3.2][RC] Twig Converter

Post by nou nou » Tue Feb 20, 2018 3:52 am

Just tested this on my test board - it works beautifully! :)

By converting the theme, I have shaved 0.1s and 1 request off my index page alone - that will start to count when talking lots of users...

Now, I also have 2 metric tons of extensions installed on that board so I'm going to ask the lazy person question - how hard would it be to do a "convert all" option in the extension that just takes your board and converts every extension and style it can find. Then all that needs to be done is upload the whole thing to the board and done, everything is converted to twig yay! :)

Of course, if something tiny should go wrong it may be a little harder to troubleshoot, but since the extension uses phpBB core to convert anyway, I think chances of that happening are low...?

User avatar
david63
Jr. Extension Validator
Posts: 13899
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Name: David Wood
Contact:

Re: [3.1][3.2][RC] Twig Converter

Post by david63 » Tue Feb 20, 2018 7:36 am

nou nou wrote:
Tue Feb 20, 2018 3:52 am
Of course, if something tiny should go wrong it may be a little harder to troubleshoot, but since the extension uses phpBB core to convert anyway, I think chances of that happening are low...?
Unless there is something in an extension that does not convert then you may not know which extension is causing the problem - also I am not sure what happens if an extension is already in Twig when you try to convert.

My advice would be convert them one by one and test after each one.
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored

nou nou
Registered User
Posts: 157
Joined: Sat Oct 29, 2016 8:08 pm

Re: [3.1][3.2][RC] Twig Converter

Post by nou nou » Wed Feb 21, 2018 3:55 am

I understand the risks very well. It's easy enough to restore what I've converted, and for that matter to upload a partial conversion.

I would still love it if there were an option to convert all at the same time, since there is no advantage to doing all the conversions themselves one by one.

User avatar
kasimi
Extension Customisations
Extension Customisations
Posts: 2644
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany
Contact:

Re: [3.1][3.2][RC] Twig Converter

Post by kasimi » Wed Feb 21, 2018 10:34 am

david63 wrote:
Tue Feb 20, 2018 7:36 am
also I am not sure what happens if an extension is already in Twig when you try to convert
In this case all files in the zip file are identical to the existing ones.

I don't think this feature needs to be added to the extension but this is how you can do it:
  • Find these lines: https://github.com/kasimi/phpbb-ext-twi ... #L114-L121
  • Replace them with these:

    Code: Select all

    $this->run('all', call_user_func_array('array_merge', array_merge(
    	array_map([$this, 'get_extension_template_files'], $available_extensions),
    	array_map([$this, 'get_style_template_files'], $available_styles)
    )));
  • Convert any extension or style. It will convert all extensions and styles.

User avatar
Froddelaar
Registered User
Posts: 707
Joined: Tue Mar 29, 2016 3:45 am
Location: Aalst (Belgium)
Name: Andy Dm
Contact:

Re: [3.1][3.2][RC] Twig Converter

Post by Froddelaar » Fri Feb 23, 2018 2:18 pm

Just an idea, would it be possible to add an option to convert ALL extensions & styles with just one click?
Wij promoten UW muziek in ons forum & delen alles via Sociale media!
Muziek wordt ook toegevoegd in de playlist van
textradio.be!
Mail uw single + hoesje + info naar: info@muziekpromo.net of Solidjeuh@textradio.be
===============
Onze Website: https://www.muziekpromo.net

User avatar
kasimi
Extension Customisations
Extension Customisations
Posts: 2644
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany
Contact:

Re: [3.1][3.2][RC] Twig Converter

Post by kasimi » Fri Feb 23, 2018 4:32 pm

Please read one post above yours.

This extension is meant to be used by extension developers for an easier transition to Twig. There really is no point in converting all template files of all your styles and extensions if your goal is improving performance because template files are cached. The time you spent reading this post is greater than the CPU time you will ever save by converting all template files.

Post Reply

Return to “Extensions in Development”

Who is online

Users browsing this forum: BadBlock and 18 guests