Twig Templater Support To Be Implemented?

Hello guys.

It's a proven fact that Smarty is not the #1 template engine anymore. There are a lot of modern templaters like Twig or Laravel's Blade.

Twig seemed pretty to us - its neat syntax simplifies creating new and supporting of the existing templates. You can check out its syntax at the "Twig for Template Designers" article.

We're thinking of implementing the support for it in CS-Cart, but this doesn't mean we're going to drop the Smarty.

It would be great if you share your thoughts on this topic here. Have you used Twig anyhow? What's your opinion on its syntax?

My own opinion is that Boilerplate theme templates would be much cleaner and easier if they were written in Twig.

IMO, would be nice someday start to use Twig instead of support old and slow Smarty.

It's a nice idea but I think CS-Cart should focus on features that add more value for store owners to help drive sales/conversions. Platforms such as Shopify abstract technical issues like this away from the store owner, so that the store owner can focus on growing their business, and not worry about the technology stack underneath it.

I still believe CS-Cart is a good solution for customizable ecommerce, but CS-Cart needs to build stability and growth opportunities for merchants to excel on this platform. If you focus on non-essential things underneath the hood like the Twig template engine, or more "object-oriented" code design, you are shaking up the core foundation of the app and risking its stability (and your customer's trust).

As a reseller/partner, I can't go back to my customers and tell them we need to bill 10 hours to rebuild the site in Twig if/when you decide to phase out Smarty. That would make me look at other platforms if it were the case.

Sure, maybe Twig templating will be cleaner, and 'prettier' to work with, but it will create work for existing store owners to convert their website instead of growing their business. I understand you could offer to run both template engines simultaneously but I can't see how that will be a smooth implementation without introducing several new bugs.

My point, overall, is that I think you should review your roadmap, look at the wishlist of features not yet implemented in CS-Cart, and focus on the ones that will help people sell more. If store owners can get more sales/value from your product and its features than the competition, then it's win-win for everyone.

My point, overall, is that I think you should review your roadmap, look at the wishlist of features not yet implemented in CS-Cart, and focus on the ones that will help people sell more. If store owners can get more sales/value from your product and its features than the competition, then it's win-win for everyone.

You are right, and we do not focus on core changes (including implementing Twig), but still consider some of them because sooner or later there will be a new major release of CS-Cart. And we want it to be technically-advanced.

At the moment as you can see from roadmap we are focused on the features that should make our clients live easier:

- Editing of email notifications and invoice in admin area.

- Change the behaviour of upgrade center while upgrading 3rd party themes. Make it now to templates in order to save client modifications.

There is always something new. But new doesn't always mean better.

Other than a cleaner syntax (maybe, maybe not), what value does Twig provide to addon developers, theme developers and the core of cs-cart? No matter which pre-processor you use, it's still going to have to compile the "language" into HTML and then cache the resulting pages.

Be nice to see a side by side example of Twig versus Smarty from a code perspective using real data driven from controllers in cs-cart. I.e. maybe something simple like and admin setup page of some kind where Smarty variables are passed and iteration and data conditions occur. Also show the difference in how you'd do things that are really ugly in Smarty like all the conditional classes (with embedded if statements) and/or things like common/button.tpl. And of course, don't forget about little things like hooks and overrides (he says facetiously).

There is always something new. But new doesn't always mean better.

Other than a cleaner syntax (maybe, maybe not), what value does Twig provide to addon developers, theme developers and the core of cs-cart? No matter which pre-processor you use, it's still going to have to compile the "language" into HTML and then cache the resulting pages.

Be nice to see a side by side example of Twig versus Smarty from a code perspective using real data driven from controllers in cs-cart. I.e. maybe something simple like and admin setup page of some kind where Smarty variables are passed and iteration and data conditions occur. Also show the difference in how you'd do things that are really ugly in Smarty like all the conditional classes (with embedded if statements) and/or things like common/button.tpl. And of course, don't forget about little things like hooks and overrides (he says facetiously).

Agreed, but we also have to grow with the technology as some point. Right now is just not the time for this.

You are right, and we do not focus on core changes (including implementing Twig), but still consider some of them because sooner or later there will be a new major release of CS-Cart. And we want it to be technically-advanced.

At the moment as you can see from roadmap we are focused on the features that should make our clients live easier:

- Editing of email notifications and invoice in admin area.

- Change the behaviour of upgrade center while upgrading 3rd party themes. Make it now to templates in order to save client modifications.

True, but instead of using twig you might as well use raintpl as this is more lightweight.

IMO, would be nice someday start to use Twig instead of support old and slow Smarty.

Not really, if you are going for performance you might as well use raintpl template engine which absolutely destroys smarty, twig, etc. in benchmarks. http://rodneyrehm.github.io/php-template-engines/htdocs/tests.html

Guys,

Twig implementation is frozen for now.

Guys,

Twig implementation is frozen for now.

I hope you will change your mind someday and start shifting to TWIG or modern ones. BTW, one of cs-cart competitors emailed me what they described as cs-cart cons. They mentioned that using Smarty in cs-cart is considered as a drawback.

P.S. I am new to cs-cart. I will be using it soon.

It may be a drawback in some people's minds because smarty was implemented/used before TWIG existed. and yes, current developers learn twig is school or online classes and don't learn smarty.

Can you please be specific on either functionality or performance concerns you have with smarty versus twig? Or is it becasue today it's more common? Switching between the two is pretty straightforward since the syntax of each is very close. However, to switch over 1500 or so smarty templates to be twig and to re-implement all the hooks and other 3rd party products that use them would need a pretty strong case for what that type of change would be a benefit.

I believe they used the new email editor as their twig experiment and found that the benefits did not outweigh the costs.

In my mind, they are simply two very similar languages that implement the same functionality with very little performance or functionality differences (other that where smarty has been extended in cs-cart for things like styles and scripts consolidation and deferral).

It may be a drawback in some people's minds because smarty was implemented/used before TWIG existed. and yes, current developers learn twig is school or online classes and don't learn smarty.

Can you please be specific on either functionality or performance concerns you have with smarty versus twig? Or is it becasue today it's more common? Switching between the two is pretty straightforward since the syntax of each is very close. However, to switch over 1500 or so smarty templates to be twig and to re-implement all the hooks and other 3rd party products that use them would need a pretty strong case for what that type of change would be a benefit.

I believe they used the new email editor as their twig experiment and found that the benefits did not outweigh the costs.

In my mind, they are simply two very similar languages that implement the same functionality with very little performance or functionality differences (other that where smarty has been extended in cs-cart for things like styles and scripts consolidation and deferral).

What about Latte though? That seems pretty much the same but slightly more sophisticated with regard to customizations (i.e. smarty_functions). Also, the auto-escape feature is pretty nice, especially for a platform like CS-Cart (where customizability is its second nature).

It may be a drawback in some people's minds because smarty was implemented/used before TWIG existed. and yes, current developers learn twig is school or online classes and don't learn smarty.

Can you please be specific on either functionality or performance concerns you have with smarty versus twig? Or is it becasue today it's more common? Switching between the two is pretty straightforward since the syntax of each is very close. However, to switch over 1500 or so smarty templates to be twig and to re-implement all the hooks and other 3rd party products that use them would need a pretty strong case for what that type of change would be a benefit.

I believe they used the new email editor as their twig experiment and found that the benefits did not outweigh the costs.

In my mind, they are simply two very similar languages that implement the same functionality with very little performance or functionality differences (other that where smarty has been extended in cs-cart for things like styles and scripts consolidation and deferral).

It seems to me like you are looking into this matter from business perspective. Although being new to this forum and to the family of CS-Cart, I can see that the performance of cs-cart is a high priority for the company (which is great) and to me also. Performance is one of the reason why TWIG is superior to Smarty.

Also, remember that thousands of templates and themes of Wordpress and other CMS's had to adapt to responsiveness someday in order to survive. The same for jQuery and Javascript.

I agree with you that is is not a critical thing. But why not having it in the queue especially that it will be straightforward (as you mentioned).

Don't know details on Latte, but believe it would have to really run circles around Smarty to justify the expense to everyone of conversion.