Post by nootkan » Mon Oct 23, 2023 10:47 am

I am used to OC 1.5.6.4 but just installed version 4.0.2.3 on my local wamp server to learn the differences (hopefully).

Running php 8.2.11, apache 2.4.51, mysql 5.7.36 on Windows 10.

Installation went fine and I noticed there is no theme folder under catalog>view like there is in version 1.5.6.4 just javascript, stylesheets and templates.

Inside the template folder are folders similar to 1.5.6.4 theme folder, but inside the files are twig instead of tpl.

Found a link to twig and read through it but will have to read it over again as it was a bit confusing.

Mind you php is not my strong suit either. Css no problem though.

Opened the twig files and it looks like an advanced version of html. Is that correct?

When I customize the example theme will it function like a child theme whereas I won't have to worry about core updates causing issues with my changes?

Will I have to occasionally tweak the example theme or does it primarily use the default theme functions etc similar to wordpress? And I should be able to leave it alone unless I want to make more changes?

Thanks for your time.

Sorry for the noob questions but just wanted to clarify before starting to make changes.

New member

Posts

Joined
Mon May 26, 2014 5:21 am

Post by nootkan » Tue Oct 24, 2023 7:09 am

Looked through the twig documents again and see it is actually php so no need to answer that question. Never seen php used that way before though. I see that my default theme is still the only theme option available when making changes inside the admin backend so I will assume the example theme does what I asked about in my previous post. I've been making changes to the css of the example theme not the default theme so when the next upgrade comes out I guess I'll find out for sure then.

New member

Posts

Joined
Mon May 26, 2014 5:21 am

Post by JNeuhoff » Tue Oct 24, 2023 4:54 pm

Twig is just another example of re-inventing the wheel.

To quote from Daniel Kerr (the author and owner of the OpenCart project):
FYI all the Twig lovers out there!
The Twig syntax is good, but the implementation and the available methods is a joke!

All the Symfony developer has done is create a garbage frame work putting 3rd party scripts into DI containers.
The Twig syntax he ripped off from Jinja and Django templates then did a garbage implementation!

The fact that this system cache is just compiling php into more php code instead of html is a disgrace!
Symfony Twig was inspired by the Python Django Template Language.

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by nootkan » Wed Oct 25, 2023 11:27 am

JNeuhoff wrote:
Tue Oct 24, 2023 4:54 pm
Twig is just another example of re-inventing the wheel.

To quote from Daniel Kerr (the author and owner of the OpenCart project):
FYI all the Twig lovers out there!
The Twig syntax is good, but the implementation and the available methods is a joke!

All the Symfony developer has done is create a garbage frame work putting 3rd party scripts into DI containers.
The Twig syntax he ripped off from Jinja and Django templates then did a garbage implementation!

The fact that this system cache is just compiling php into more php code instead of html is a disgrace!
Symfony Twig was inspired by the Python Django Template Language.
JNeuhoff, thanks for the reply. I read that during my research and wondered why the owner of open cart would use it if he didn't like it. I liked the old tpl system.

Still playing around with the default (example) theme css files and the site is starting to look like my old one more and more.

Thanks for the djangoproject link, I'll give it a read to see if it helps me make sense of twig.

New member

Posts

Joined
Mon May 26, 2014 5:21 am

Post by khnaz35 » Wed Oct 25, 2023 1:13 pm

nootkan wrote:
Wed Oct 25, 2023 11:27 am
I read that during my research and wondered why the owner of open cart would use it if he didn't like it.
Twig is a newer templating engine that was introduced in Drupal 8. It is a compiled template engine, which means that it converts template files into PHP code before they are executed. This makes Twig templates faster and more secure than TPL templates.

@nootkan you may wana read more about here
Twig documentation: https://twig.symfony.com/doc/

Twig on Drupal.org: https://www.drupal.org/docs/develop/the ... -in-drupal

Just to make it simple
Twig templates can be reused.
Twig templates can be cached.
Twig templates can be secured.

Got an urgent question that’s keeping you up at night? There might just be a magical inbox ready to help: khnaz35@gmail.com
Enjoy nature ;) :) :-*


User avatar
Active Member

Posts

Joined
Mon Aug 27, 2018 11:30 pm
Location - Malaysia

Post by JNeuhoff » Wed Oct 25, 2023 7:27 pm

khnaz35 wrote:
Wed Oct 25, 2023 1:13 pm
It is a compiled template engine, which means that it converts template files into PHP code before they are executed. This makes Twig templates faster and more secure than TPL templates.
Symfony Twig is a collection of at least 174 PHP class files at my last count. Twig templates aren't cached, the resulting PHP code is. It's not faster than PHP templates!

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by khnaz35 » Wed Oct 25, 2023 9:46 pm

JNeuhoff wrote:
Wed Oct 25, 2023 7:27 pm
Symfony Twig is a collection of at least 174 PHP class files at my last count. Twig templates aren't cached, the resulting PHP code is. It's not faster than PHP templates!
You're right about the internal workings of Twig; it indeed compiles templates into PHP code for execution, leading to caching of the PHP code rather than the templates themselves. While raw PHP templates might be faster in execution due to no templating overhead, Twig offers substantial benefits. Its automatic escaping enhances security, its syntax promotes cleaner code, and it overall boosts developer productivity. The performance gap narrows significantly when Twig’s caching capabilities are considered, making it a preferred choice for many developers.

Got an urgent question that’s keeping you up at night? There might just be a magical inbox ready to help: khnaz35@gmail.com
Enjoy nature ;) :) :-*


User avatar
Active Member

Posts

Joined
Mon Aug 27, 2018 11:30 pm
Location - Malaysia

Post by JNeuhoff » Wed Oct 25, 2023 10:40 pm

Actually, the Twig syntax is one of its worst aspects, it's not based on a proper LALR(1) grammar. The expression syntax is unconventional, such as for the bitwise boolean operators ('b-and', 'b-or', 'b-xor') , the usage of '~' as a string concatenation (that one should be the common bitwise complement of a numerical value), wrong operator precedence for e.g. the unary 'not' operator. Or the confusing arrow function syntax. Not to mention some functions or filters which belong to the controller logic, not a template language.

A good template engine can be beneficial for a MVC framework, Symfony Twig doesn't cut it!

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by khnaz35 » Thu Oct 26, 2023 12:11 am

JNeuhoff wrote:
Wed Oct 25, 2023 10:40 pm
A good template engine can be beneficial for a MVC framework, Symfony Twig doesn't cut it!
May be some alternative , could be use but its allot of work to push those changes into git repo.

Got an urgent question that’s keeping you up at night? There might just be a magical inbox ready to help: khnaz35@gmail.com
Enjoy nature ;) :) :-*


User avatar
Active Member

Posts

Joined
Mon Aug 27, 2018 11:30 pm
Location - Malaysia

Post by JNeuhoff » Thu Oct 26, 2023 12:36 am

khnaz35 wrote:
Thu Oct 26, 2023 12:11 am
May be some alternative , could be use but its allot of work to push those changes into git repo.
It's probably easier to add support for some other template engines, which 3rd party authors or theme designers can optionally use, like we did for the OpenCart Template Switcher.

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by nootkan » Fri Oct 27, 2023 7:06 am

@nootkan you may wana read more about here
Twig documentation: https://twig.symfony.com/doc/

Twig on Drupal.org: https://www.drupal.org/docs/develop/the ... -in-drupal
khnaz35, thanks for the links will try to get to them for a read when I can free up some time.

New member

Posts

Joined
Mon May 26, 2014 5:21 am

Post by nootkan » Fri Oct 27, 2023 7:10 am

I am finding this thread educational reading the difference of opinions and hope I haven' stirred up a bees nest.

Hopefully I can keep gleaning some great information which may help me understand twig better. Thanks guys.

New member

Posts

Joined
Mon May 26, 2014 5:21 am
Who is online

Users browsing this forum: No registered users and 10 guests