[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!
Suggested Hosts
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)
User avatar
kasimi
Extension Customisations
Extension Customisations
Posts: 2076
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany
Contact:

[3.1][3.2][RC] Twig Converter

Post by kasimi » Fri Jun 30, 2017 8:22 pm

Extension Name: Twig Converter

Author: kasimi

Extension Description: This extension converts template files using phpBB syntax to template files using Twig syntax. It adds a very simple ACP module with a dropdown list of all available extensions and styles. When submitting the form, it downloads a zip file with all .html template files found within the selected extension or style folder, converted to Twig syntax.

This extension is a development tool and should not be used in a production environment.

Extension Version: 1.2.0

Requirements: Since version 1.2.0 of this extension, you need phpBB 3.2.x or the latest master branch (3.3.x). For phpBB 3.1.x, please use version 1.1.1.

Screenshots:

Image

Extension Download:

GitHub Releases: https://github.com/kasimi/phpbb-ext-twi ... r/releases
GitHub Repo: https://github.com/kasimi/phpbb-ext-twigconverter

User avatar
3Di
Registered User
Posts: 11718
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milano - Frankfurt
Name: Marco
Contact:

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

Post by 3Di » Fri Jun 30, 2017 8:32 pm

Cool, kasimi. What a great idea!

+ {{ put here a number }}
Want to compensate me for my interest? Donate
Please PM me only to request paid works. Thx.
Extensions, Scripts, MOD porting, Update/Upgrades

Toxyy
Registered User
Posts: 320
Joined: Mon Oct 24, 2016 3:22 pm

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

Post by Toxyy » Fri Jun 30, 2017 9:01 pm

I just did this by hand about a day ago. You should have released this sooner!!

How do you handle loops?

Also, any bugs or kinks?
I am a web developer/administrator, specializing in forums. If you have work you need done or are too lazy to do, pm me!

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

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

Post by kasimi » Fri Jun 30, 2017 9:14 pm

I wrote this only today. :P After having written a Python script yesterday with ugly regular expressions that didn't even cover all syntax features, I realized that phpBB does the conversion internally already, so this extension just reuses core code, which means that if your template files with phpBB syntax work as intended, this extension is able to convert them without problems. :)

Toxyy
Registered User
Posts: 320
Joined: Mon Oct 24, 2016 3:22 pm

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

Post by Toxyy » Fri Jun 30, 2017 11:35 pm

That's great. How about support for selecting individual files/folders? Only reading html files of course.
I am a web developer/administrator, specializing in forums. If you have work you need done or are too lazy to do, pm me!

User avatar
david63
Jr. Extension Validator
Posts: 12841
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 » Sat Jul 01, 2017 9:05 am

Just a thought - could this be used to convert core templates?
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 or as they will be ignored

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

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

Post by kasimi » Sat Jul 01, 2017 9:17 am

Toxyy wrote:
Fri Jun 30, 2017 11:35 pm
How about support for selecting individual files/folders?
Converting doesn't take long and is done only once, usually. You could just convert all .html files and extract only the ones you need from the zip archive. I don't think adding support for individual files is worth it.
david63 wrote:
Sat Jul 01, 2017 9:05 am
could this be used to convert core templates?
Yes indeed, good idea. I just tested this by copying the styles/prosilver folder to ext/kasimi/twigconverter/prosilver and doing the conversion, and it worked.

User avatar
HiFiKabin
Community Team Member
Community Team Member
Posts: 2156
Joined: Wed May 14, 2014 9:10 am
Name: James
Contact:

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

Post by HiFiKabin » Sat Jul 01, 2017 11:03 am

Very clever and very useful addition to the 'tool box'

User avatar
pierredu
Registered User
Posts: 786
Joined: Thu Nov 01, 2012 8:04 am
Location: Paris (France)
Name: Pierre Duhem

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

Post by pierredu » Sat Jul 01, 2017 3:49 pm

Fine idea. Thanks.

User avatar
Froddelaar
Registered User
Posts: 483
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 » Sat Jul 01, 2017 6:03 pm

Great extension! So maybe the phpBb team can use this to convert the prosilver style?
Tested the ext on phpBB 3.2.1 RC1 and works great!
I'm A Stupid F*ck.. And Proud Of it!
Download +34.000 arcade extension games @ ~ https://www.froddelpower.be ~

Dutch Extension Translations @ https://github.com/Solidjeuh
Donations are always welcome @ https://www.froddelpower.be/donation

User avatar
canonknipser
Registered User
Posts: 1131
Joined: Thu Sep 08, 2011 4:16 am
Location: Germany
Name: Frank Jakobs
Contact:

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

Post by canonknipser » Sat Jul 01, 2017 6:55 pm

Great extension!

Currently you are checking only the ext-folder for html-files? Is it possible to check also the styles-Folder to convert styles without copying them to the ext-folder?
Greetings
Frank
phpbb.de support team member
English is not my native language
New arrival - Extensions and scripts for phpBB
no support via PM or mail

User avatar
RMcGirr83
Recognised Extension Developer
Posts: 20268
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 » Sat Jul 01, 2017 8:28 pm

Ditto on the great extension, makes it so easy for extension writers to convert.

:+1:
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: 2076
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany
Contact:

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

Post by kasimi » Sat Jul 01, 2017 8:53 pm

Glad to hear it's useful to others. :)
canonknipser wrote:
Sat Jul 01, 2017 6:55 pm
Is it possible to check also the styles-Folder to convert styles without copying them to the ext-folder?
There's a new version 1.1.0 that adds support for converting styles. It also fixes a critical directory traversal bug in 1.0.0 that could be used to extract .html files from outside of phpBB's root folder. Please update!

For the latest download see the link to the GitHub releases in the first post.

User avatar
Ibedejo
Registered User
Posts: 210
Joined: Tue Feb 21, 2012 12:12 am

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

Post by Ibedejo » Sat Jul 01, 2017 10:16 pm

Great extension and a perfect help!

Chapeau! :D

User avatar
3Di
Registered User
Posts: 11718
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milano - Frankfurt
Name: Marco
Contact:

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

Post by 3Di » Sat Jul 01, 2017 10:31 pm

RMcGirr83 wrote:
Sat Jul 01, 2017 8:28 pm
Ditto on the great extension, makes it so easy for extension writers to convert.

:+1:
Yeah, that's not "greek" anymore uh? :)
Want to compensate me for my interest? Donate
Please PM me only to request paid works. Thx.
Extensions, Scripts, MOD porting, Update/Upgrades

Post Reply

Return to “Extensions in Development”

Who is online

Users browsing this forum: No registered users and 15 guests