[3.1][3.2][3.3][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!
Anti-Spam Guide
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
mrgoldy
Former Team Member
Posts: 1394
Joined: Tue Oct 06, 2009 7:34 pm
Location: The Netherlands
Name: Gijs

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

Post by mrgoldy »

Out of curiosity;
Is it possible to run a vanilla prosilver through this converter and receive a working style? Or are there any files that will need adjusting afterwards? Have you (or anyone else for that matter) tried that already?
phpBB Studio / Member of the Studio

Contributing: You can do it too! Including testing Pull Requests (PR).
phpBB Development and Testing made easy.
User avatar
kasimi
Former Team Member
Posts: 4900
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany

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

Post by kasimi »

David had this idea and the feature was added to version 1.1.0. phpBB converts all template files to Twig before caching them anyway, so converting prosilver shouldn't be necessary. That feature is mainly geared towards style authors.
User avatar
mrgoldy
Former Team Member
Posts: 1394
Joined: Tue Oct 06, 2009 7:34 pm
Location: The Netherlands
Name: Gijs

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

Post by mrgoldy »

Currently on my phone and I hate the search on it, my bad :flushed:

And I am writing a style based on prosilver for personal use and due to extension writing I am now more used to the twig syntax than phpbb's.

Anyway, thanks for the quick response.
phpBB Studio / Member of the Studio

Contributing: You can do it too! Including testing Pull Requests (PR).
phpBB Development and Testing made easy.
User avatar
Galixte de EzCom
Registered User
Posts: 1106
Joined: Mon Oct 04, 2004 11:14 pm
Location: France
Name: Raphaël M.

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

Post by Galixte de EzCom »

Hi kasimi,
kasimi wrote: Wed Mar 07, 2018 9:40 pm
oxpus wrote:Mon Jun 03, 2019 6:23 pmColons are missing by twig style convertor extension
Source: https://github.com/oxpus/Download-32-Ex ... -498327691.

Is it possible to add this feature?

Regards.
Communau EzCom
📖 « Traductions d’extensions & styles pour phpBB 3.2.x & 3.3.x ».
📋 Lists of all extensions identified for phpBB 3.1.x & 3.2.x.
📋 Lists of all styles identified for phpBB 3.1.x & 3.2.x.
Image Tu as un forum et tu veux aussi un site web ? Regarde par ici.
User avatar
3Di
I've Been Banned!
Posts: 17538
Joined: Mon Apr 04, 2005 11:09 pm
Location: I'm with Ukraine 🇺🇦
Name: Marco

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

Post by 3Di »

Colons aren't missing if not hard-coded.

Example of old syntax: {L_CONTACT}{L_COLON}

Not {L_CONTACT}:
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Buy me a coffee -> Image
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
User avatar
Tastenplayer
Registered User
Posts: 999
Joined: Thu Jul 03, 2014 9:20 pm
Location: Village in the middle of Switzerland
Name: Jutta Koliofotis

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

Post by Tastenplayer »

According to Requirements: it should work in 3.3.x. ? In 3.3.0-b2 I get an error message. Does this Ext normally work in 3.3.0-b2?
More of my styles you can find in my phpBB Style Board & More
Be the best version of yourself rather than a bad copy of someone else!
Excuse me for my English, but I learned the language by speaking to people and not at school.
🎨 All my styles are updated to 3.3.8 and can be downloaded here
User avatar
david63
Registered User
Posts: 20646
Joined: Thu Dec 19, 2002 8:08 am

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

Post by david63 »

Tastenplayer wrote: Wed Nov 27, 2019 5:10 pm I get an error message
Which says?????
David
Remember: You only know what you know and - you don't know what you don't know!

I now no longer support any of my extensions but they will start to become available here
User avatar
andares
Registered User
Posts: 100
Joined: Sat Feb 28, 2009 5:53 pm
Location: Spain
Name: Pedro

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

Post by andares »

In 3.3.0-b2 I get an error message:

Code: Select all

Fatal error: Uncaught TypeError: Argument 1 passed to lexer_0f47be9::tokenize() must be an instance of Twig\Source, string given, called in /srv/disk1/2868406/www/xxx.atspace.cc/ext/kasimi/twigconverter/controller/main.php on line 267 and defined in /srv/disk1/2868406/www/xxx.atspace.cc/cache/production/container_dbdbe80dc7030ae9bd39ee30cca82130.php:4857 Stack trace: #0 /srv/disk1/2868406/www/xxx.atspace.cc/ext/kasimi/twigconverter/controller/main.php(267): lexer_0f47be9->tokenize('<!-- INCLUDECSS...', 'ext/kirk/stylec...') #1 /srv/disk1/2868406/www/xxx.atspace.cc/ext/kasimi/twigconverter/controller/main.php(245): kasimi\twigconverter\controller\main->convert_files(Array) #2 /srv/disk1/2868406/www/xxx.atspace.cc/ext/kasimi/twigconverter/controller/main.php(116): kasimi\twigconverter\controller\main->run('kirk/stylechang...', Array) #3 /srv/disk1/2868406/www/xxx.atspace.cc/ext/kasimi/twigconverter/acp/main_module.php(28): kasimi\twigconverter\controlle in /srv/disk1/2868406/www/xxx.atspace.cc/cache/production/container_dbdbe80dc7030ae9bd39ee30cca82130.php on line 4857
Sorry for my bad English, I use a translator...
Spanish phpBB Support at https://www.phpbb-es.com
User avatar
Tastenplayer
Registered User
Posts: 999
Joined: Thu Jul 03, 2014 9:20 pm
Location: Village in the middle of Switzerland
Name: Jutta Koliofotis

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

Post by Tastenplayer »

I didn't want to insert the error code unnecessarily if it's already clear that the Ext in 3.3.0-b2 doesn't work. Sorry
I don't have exactly the same error message, because a local Quickinstall TB in Xampp.
I have also installed the stylechanger from Kirk but there are no bugs or a mention of in this Ext from Kasimi therefore, as in the code by Andares. I wanted to convert my style not an extension. Maybe that's why.

Code: Select all

Fatal error: Uncaught TypeError: Argument 1 passed to lexer_0f47be9::tokenize() must be an instance of Twig\Source, string given, called in C:\xampp\htdocs\quickinstall-1.3.6\boards\3.3.0b2_style_tb\ext\kasimi\twigconverter\controller\main.php on line 257 and defined in C:\xampp\htdocs\quickinstall-1.3.6\boards\3.3.0b2_style_tb\cache\production\container_dbdbe80dc7030ae9bd39ee30cca82130.php:4430 Stack trace: #0 C:\xampp\htdocs\quickinstall-1.3.6\boards\3.3.0b2_style_tb\ext\kasimi\twigconverter\controller\main.php(257): lexer_0f47be9->tokenize('\n<!-- BEGIN for...', 'styles/Graphit/...') #1 C:\xampp\htdocs\quickinstall-1.3.6\boards\3.3.0b2_style_tb\ext\kasimi\twigconverter\controller\main.php(235): kasimi\twigconverter\controller\main->convert_files(Array) #2 C:\xampp\htdocs\quickinstall-1.3.6\boards\3.3.0b2_style_tb\ext\kasimi\twigconverter\controller\main.php(120): kasimi\twigconverter\controller\main->run('Graphit', Array) #3 C:\xampp\htdocs\quickinstall-1.3.6\boards\3.3.0b2_style_tb\ext\kasimi\twigconverter\acp\main_mo in C:\xampp\htdocs\quickinstall-1.3.6\boards\3.3.0b2_style_tb\cache\production\container_dbdbe80dc7030ae9bd39ee30cca82130.php on line 4430
It can't be an error from my style either - trying Prosilver brought the same error code.
More of my styles you can find in my phpBB Style Board & More
Be the best version of yourself rather than a bad copy of someone else!
Excuse me for my English, but I learned the language by speaking to people and not at school.
🎨 All my styles are updated to 3.3.8 and can be downloaded here
User avatar
kasimi
Former Team Member
Posts: 4900
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany

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

Post by kasimi »

phpBB 3.3 uses a more recent version of Twig that doesn't allow accessing the parsed code anymore. I'll look into it when time allows.
rxu
Extensions Development Team
Posts: 4065
Joined: Wed Oct 25, 2006 12:46 pm
Location: Siberia, Russian Federation

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

Post by rxu »

The following worked for me:
replacing 2 rows here https://github.com/kasimi/phpbb-ext-twi ... #L267-L268 with

Code: Select all

$source = $this->lexer->tokenize(new \Twig_Source($contents, $filename))->getSourceContext();
$converted_syntax[$filename] = $source->getCode();
User avatar
Mannix_
Registered User
Posts: 2122
Joined: Sun Oct 25, 2015 2:56 pm
Name: Matt

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

Post by Mannix_ »

rxu wrote: Thu Nov 28, 2019 3:52 pm The following worked for me:
replacing 2 rows here https://github.com/kasimi/phpbb-ext-twi ... #L267-L268 with

Code: Select all

$source = $this->lexer->tokenize(new \Twig_Source($contents, $filename))->getSourceContext();
$converted_syntax[$filename] = $source->getCode();
Worked for me to ty :)
Did I helped You? Consider a donation.
New version of phpBB has been released? My styles aren't validated for it yet? Check my page for the latest downloads!
User avatar
andares
Registered User
Posts: 100
Joined: Sat Feb 28, 2009 5:53 pm
Location: Spain
Name: Pedro

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

Post by andares »

rxu wrote: Thu Nov 28, 2019 3:52 pm The following worked for me:
replacing 2 rows here https://github.com/kasimi/phpbb-ext-twi ... #L267-L268 with

Code: Select all

$source = $this->lexer->tokenize(new \Twig_Source($contents, $filename))->getSourceContext();
$converted_syntax[$filename] = $source->getCode();
It seems to work well, Спасибо :)
Sorry for my bad English, I use a translator...
Spanish phpBB Support at https://www.phpbb-es.com
User avatar
Tastenplayer
Registered User
Posts: 999
Joined: Thu Jul 03, 2014 9:20 pm
Location: Village in the middle of Switzerland
Name: Jutta Koliofotis

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

Post by Tastenplayer »

I tried to convert my style in my local TB:

Failed to create zip file.

Quickinstall TB in Xampp - Win10
Database server: MySQL(i) 10.1.34-MariaDB
PHP version: 7.1.19
More of my styles you can find in my phpBB Style Board & More
Be the best version of yourself rather than a bad copy of someone else!
Excuse me for my English, but I learned the language by speaking to people and not at school.
🎨 All my styles are updated to 3.3.8 and can be downloaded here
User avatar
kasimi
Former Team Member
Posts: 4900
Joined: Sat Sep 10, 2011 7:12 pm
Location: Germany

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

Post by kasimi »

Version 1.3.0 is available in the first post.
  • Compatibility with phpBB 3.3.x, thanks rxu for the fix
  • Added ZIP error code to error message

@Tastenplayer, try again with this version, it will tell you an error code.

Return to “Extensions in Development”