Post by eka7a » Mon Jan 09, 2017 3:35 pm

Hi Guys,

Knows those who follow github project page but if need to say it again, OpenCart will switching to twig template engine in new versions (Unless there is a decision change :) ). You can follow the developments here.

PHP theme support will continue but by default it will be released with twig theme. It may take some time to get used to this change. Especially for developers(like me :) ) who do not have knowledge about twig engine. Your can easily online php to twig using this tool. May be a mistake because it is a beta version.

=== PHP2TWIG ===

You can try following code immediately to see differences.

Code: Select all

<?php if ($hi == 'Hello Earthling') {
echo 'Hello Alien';
} ?>
More information about Twig engine can be found here.
Has been developed with this here library.


User avatar
Active Member

Posts

Joined
Sun Apr 12, 2009 12:59 am
Location - Türkiye

Post by Johnathan » Mon Jan 09, 2017 11:42 pm

Thanks for the link, appreciated.

Image
Image Image Image Image Image Image


User avatar
Global Moderator

Posts

Joined
Fri Dec 18, 2009 3:08 am


User avatar
Active Member

Posts

Joined
Sun Apr 12, 2009 12:59 am
Location - Türkiye

Post by mmosolution » Thu Jul 06, 2017 6:31 pm

i have developed another tool too
http://openconverter.io

Image
MMOSolution.com
"Changing your challenges into opportunities!"


User avatar
Newbie

Posts

Joined
Mon Dec 05, 2016 11:58 am
Location - Vietnam

Post by JNeuhoff » Mon Jul 10, 2017 12:11 am

mmosolution wrote:
Thu Jul 06, 2017 6:31 pm
i have developed another tool too
http://openconverter.io
Your tool doesn't work for larger template files, it truncates them in the middle.

I have also tried all the other converter tools mentioned on this forum thread, they are all buggy.

Does anybody know of a decent php to twig conversion tool?

MHC Web Design
Override Engine * Integrated VQMod * Multilingual SEO * Instant Option Price Calculator * TrustPilot Reviews * Download Options * Free Download Buttons * Export/Import Tool * Template Switcher PHP/Twig


User avatar
Expert Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by HCGeek » Sun Sep 10, 2017 8:32 pm

JNeuhoff wrote:
Mon Jul 10, 2017 12:11 am
Your tool doesn't work for larger template files, it truncates them in the middle.
Change all "&" or "&&" symbols to the word "and"
I have heavy modified tpl file that had no issues converting after I changed all the "&&" to "and".

<?php if ($column_left && $column_right) { ?>
to
<?php if ($column_left and $column_right) { ?>

Hope this helps.

Newbie

Posts

Joined
Thu May 07, 2015 6:38 am

Post by MrPhil » Mon Sep 11, 2017 2:00 am

HCGeek wrote:
Sun Sep 10, 2017 8:32 pm
Change all "&" or "&&" symbols to the word "and"
Be careful there. and is somewhat different from && (it has much lower precedence), and totally different from & (bitwise-AND operator). It may work in some simple cases, but will break in other cases.

Active Member

Posts

Joined
Wed May 10, 2017 11:52 pm

Post by JNeuhoff » Mon Sep 11, 2017 5:04 pm

I stopped bothering with Twig while upgrading old extensions to OpenCart 3.0.2.0. We ended up using a simple event handler which automatically detects whether twig or PHP is being used and then automatically chooses the correct rendering engine.

MHC Web Design
Override Engine * Integrated VQMod * Multilingual SEO * Instant Option Price Calculator * TrustPilot Reviews * Download Options * Free Download Buttons * Export/Import Tool * Template Switcher PHP/Twig


User avatar
Expert Member

Posts

Joined
Wed Dec 05, 2007 3:38 am

Who is online

Users browsing this forum: No registered users and 13 guests