barry_k Posted October 21, 2011 Share Posted October 21, 2011 Hi, Anyone else hate the smarty templating language as much as I do? I think prestashop should move over to CSS and HTML5 templating instead. I understand why SMARTY is used for projects but I find it actually complicates things. Anyone else agree? 3 Link to comment Share on other sites More sharing options...
OC2PS Posted October 22, 2011 Share Posted October 22, 2011 I kind of agree. In fact, PHP itself is really a templating engine, though not a great one. So in comes Smarty - a templating engine for PHP. Problem is - Smarty's not very good either. So, yeah, would be good if PS dropped Smarty....though I suspect a lot of work would be required for that to happen... Link to comment Share on other sites More sharing options...
OC2PS Posted October 22, 2011 Share Posted October 22, 2011 Or a proper templating engine could be used, e.g. Twig http://twig.sensiolabs.org/ Advantages: object architecture native inheritance fast (compiles everything down to PHP) - one of fastest one I have seen secure (e.g. escaping by default) sandbox extensibility: you override everything, even the core features while normally a templating engine adds another thing to learn for the developer, Twig is very easy to learn. 1 Link to comment Share on other sites More sharing options...
Snade Posted October 23, 2011 Share Posted October 23, 2011 ridiculously funny Link to comment Share on other sites More sharing options...
OC2PS Posted October 23, 2011 Share Posted October 23, 2011 ridiculously funny I take it that you are not a fan of Twig...it's the closest one to Django that I've seen... The thing is that there's literally 1000s of templating engines for PHP, each with its own fans and detractors....in my opinion none of them really gets the job done... Link to comment Share on other sites More sharing options...
mexique1 Posted October 31, 2011 Share Posted October 31, 2011 +1 Remove Smarty, it's completely obsolete... The only thing we need is PHP !!! Just check this article form a guy who wrote a book on Smarty : http://hasin.wordpress.com/2008/01/05/once-upon-a-time-there-was-smarty/ We need a layout system, rather that dozens of files opening a div that is closed in another file 2 Link to comment Share on other sites More sharing options...
Snade Posted October 31, 2011 Share Posted October 31, 2011 Maybe smarty is not the best solution, but for me it was funny that you request modification of something so fundamental for prestashop. It will be absolutely new platform, rewritten almost from scratch and no backward compatibility. I bet that prestashop team with stick with the system they are developing so many years... Link to comment Share on other sites More sharing options...
mexique1 Posted October 31, 2011 Share Posted October 31, 2011 Maybe smarty is not the best solution Is it a crime to wish the best for PrestaShop ? Read the article, you will understand why we don't need Smarty anymore. Smarty was written a long time ago, when the MVC pattern was not obvious for everybody. Backward compatibility is not impossible... This is just a matter of resolving the views with the appropriate priority. Link to comment Share on other sites More sharing options...
yodapt Posted October 31, 2011 Share Posted October 31, 2011 I like Mustache, it's simple, no major logic implied, cross-language (no references to any specific language) and safe. https://github.com/bobthecow/mustache.php Once again : anyone willing to build a stable, reliable and flexible "version" of Prestashop? Really .. I feel ashamed to find out this is the best my fellow coders can do Link to comment Share on other sites More sharing options...
barry_k Posted November 2, 2011 Author Share Posted November 2, 2011 If Prestashop move to HTML 4/5 and CSS themes, more themes can be created that are both industry standard, feature rich and beautiful, templates only makes thinks more complicated. No one uses template languages any more, they create bad habits and lock the project into one system one approach. We also need a simplier and more streamlined administrative panel again HTML/CSS can allow a nicer approach. Link to comment Share on other sites More sharing options...
Fabien Serny Posted November 2, 2011 Share Posted November 2, 2011 Hi all, We think about that. As you see in this topic, it's very difficult to choose. Some of you want twig, some of you want mustache, some of want just PHP and I'm talking about the one who want to keep Smarty (yes they are some ^^). So even if we change, there will still be unhappy front end developer. Anyway, removing Smarty for Twig, for example, will remove compatibility to all existing theme, a lot of merchants and developers won't be happy about it. NB : @barry_k I don't understand why you can't use HTML 5 with Smarty :/ Or maybe I did not understand what you tried to do. Link to comment Share on other sites More sharing options...
mexique1 Posted November 2, 2011 Share Posted November 2, 2011 it's very difficult to choose Then, offer the possibility to choose the template engine ! Offer an implementation of each of the cutting-edge template engines, and let the developer decide what to use. We could even mix up template languages ! For example in Spring Framework, there is no problem with using Velocity, JSP, Freemarker in the same webapp. Link to comment Share on other sites More sharing options...
Fabien Serny Posted November 2, 2011 Share Posted November 2, 2011 We thought about that but this mean that we will have to add library to PS (Twig, Mustache, and other library that developers will ask us). I don't say it's not possible, I don't say I don't want to do it (in fact I think it will be pretty cool to have this kind of system ), but I don't think we will do it in the first 1.5 But I will talk about this with others developers and let you know. Best regards, Link to comment Share on other sites More sharing options...
mexique1 Posted November 2, 2011 Share Posted November 2, 2011 Ok, thanks for the effort Fabien. Link to comment Share on other sites More sharing options...
yodapt Posted November 2, 2011 Share Posted November 2, 2011 Some of you want twig, some of you want mustache, some of want just PHP and I'm talking about the one who want to keep Smarty (yes they are some ^^). So even if we change, there will still be unhappy front end developer. What's the PS administration waiting to launch a pool to decide and discuss that? I'm sure there's a solution. In fact, I think PS shouldn't stick to just only template engine, but that would imply the template driver to be dynamic (not a problem), and possibly separate the PS code into framework and custom layer. Link to comment Share on other sites More sharing options...
Fabien Serny Posted November 2, 2011 Share Posted November 2, 2011 Hi yodapt, You should read the three post above yours Link to comment Share on other sites More sharing options...
OC2PS Posted November 2, 2011 Share Posted November 2, 2011 It will be absolutely new ... rewritten almost from scratch... I bet that prestashop team with stick with the system they are developing so many years... I agree. That's why I said.. I suspect a lot of work would be required for that to happen... It will be absolutely new platform, rewritten almost from scratch and no backward compatibility. I beg to differ on the "platform" and "compatibility" aspects. We are talking only about the View layer...so there need not be a new platform, nor an impact on backward compatibility, except for compatibility with old themes. offer the possibility to choose the template engine ! Offer an implementation of each of the cutting-edge template engines, and let the developer decide what to use. We thought about that but this mean that we will have to add library to PS (Twig, Mustache, and other library that developers will ask us). I don't say it's not possible, I don't say I don't want to do it (in fact I think it will be pretty cool to have this kind of system ) On the face of it, this sounds interesting and cool. However, I would strongly advise against it. There are far more valuable things lacking in PS that need more immediate attention: http://www.prestasho...id-like-to-see/ A significant amount of maintenance would be required thereby a) Taking away developer time in every release, and delaying every release Irrespective of what you may think now, it WILL complicate things, making the code *more* vulnerable to errors it's very difficult to choose. Some of you want twig, some of you want mustache, some of want just PHP and I'm talking about the one who want to keep Smarty (yes they are some ^^). So even if we change, there will still be unhappy front end developer. I think you will please the vast majority of community developers if you choose PHP. Additionally, you will *unexpectedly* please store owners, who will suddenly experience improved performance Link to comment Share on other sites More sharing options...
Fabien Serny Posted November 2, 2011 Share Posted November 2, 2011 Hi OC2S, You've just made my point. Whatever the choice we will made, there will always be not satisfied developer How can you be sure that the vast majority of community developers will be pleased if we chose PHP ? Do you really think that the developers who have already made themes will be happy about the fact that their theme won't work anymore ? Do you really think that merchant will be happy about the fact that they can't upgrade PrestaShop if they don't remake the theme ? We accidently break the theme template system between to little version (1.4.2 / 1.4.3). There were only a few modifications to make the theme compliant, all themes developers complained (and they were right about it). So you can understand that the choice is not so obvious for us ^^ We will discuss this point with the others developers, but as you said, there are lot of things more important to do first Nb : For the improved performance, I could not agree more Nb2 : Do not hesitate to participate on others topics of 1.5 Link to comment Share on other sites More sharing options...
OC2PS Posted November 2, 2011 Share Posted November 2, 2011 I have absolutely no doubt that many of the theme developers who have themes in the market and many of the store-owners will complain if you flicked a switch and changed over to any other templating system. Not a shred of doubt about that. That would happen even when Smarty upgrades (it's never 100% compatible, irrespective of what they might say). So in deciding to make the move, PS will need to provide a transition path and transition period, over the course of 2-3 releases. I think what we are discussing here is more from the normative point of view i.e. where PS should be headed, rather than from an immediate implementation perspective. From an immediate perspective, there are many more important things to do, rather than mess with something that is working. As regards why I think most developers would prefer PHP: Over the years, I've had numerous conversations with developers, and have had overwhelming feedback in favor of PHP. You end up reaching a wider overall audience as developers don't need to learn a new language....as opposed to templating engines, of which there are literally thousands for PHP....which basically splits a large PHP group into many small groups. If you check out any online discussion boards on the topic, you'll see developers' clear preference for PHP over other templating engines... There is no real rational reason anymore for templating engines for PHP...separation of concerns is already part of the framework via MVC, and I've always found the supposed sandboxing logic rather hokey...but particularly because PS is opensource, this is irrelevant. 1 Link to comment Share on other sites More sharing options...
Burhan BVK Posted November 2, 2011 Share Posted November 2, 2011 Removing smarty is probably the worst thing that can be done for Prestashop. Everyone thinks that everybody else wants the same features/changes they want. Everyday I see a ton of posts asking about a feature claiming that everyone wants it, that it is a necessary feature. The fact is, if you change smarty all of a sudden hundreds of modules and themes will have to be rewritten, a lot of people will not be happy all the old modules they have suddenly stopped working, and they would have to redo their old template etc. A shift from smarty to a different template system would drive a lot of people away, and still take too long. At then end you would have a portion of the user base Prestashop currently has, fewer people working to expand it. You would either end up with a similar template engine with not much technical advantage, or a php templating system with a lot of confused site owners and designers. Disadvantages grossly outweighs any advantage you might gain by removing smarty. As a developer, and a quite experienced and good one at that, I would use template engine even if this was new project. Using only php might be a good idea if only a few people are working on the same project. But prestashop is an open collaboration project, there are a lot of people with different skill levels working on the same code base. People who have no knowledge of php can still make minor modifications to templates without much effort. Smarty syntax is much less convoluted than php. Link to comment Share on other sites More sharing options...
OC2PS Posted November 2, 2011 Share Posted November 2, 2011 Your logic seems to be basically that since we made a mistake once, now we are stuck with it, and should do nothing to fix it I don't think that's very tenable. As for people with different level of skills working on it, that's totally hokum. It's not as if everyone in the world knows Smarty and don't have to learn it....and if they have to learn something, might as well learn PHP.... Link to comment Share on other sites More sharing options...
Fabien Serny Posted November 2, 2011 Share Posted November 2, 2011 I had to answer to your last post. Your logic seems basic too You said with Smarty you have to learn, with PHP you don't. I disagree. Even with PHP template, you have to learn, look at Wordpress, even an experimented developer can't make a template if he does not know what functions he can use (ok they have a good codex, but still, you have to read and learn first). I agree with Whitelighter, it's not because one developer say, "you must have this feature and all people are agree with me", that he will be right (we can use the same argument against Whitelighter too ^^). I mean, Whitelighter said he want to keep Smarty, you said you want to have PHP template. It's the perfect example that we never got community satisfied this way. How can one of you be sure that a majority of developer is agree with you ? I think I'm a quite experimented developer, I will never say that a majority is agree with me, by the simple fact that I can be sure. The majority of developers I know are generally agree with me but I will never transform this fact in "a majority of developers is agree with me". To conclude this, I'm pretty sure, that if one day we change, we will keep compatibility to Smarty. I think make an abstract template class is not very hard and if it's well done, there will no error with it. I think it's the only way to make the community happy and able to develop the theme the way they want. The default theme will remain in Smarty (because keep updated theme in all templating motor will be too much work). Maybe the community will participate and keep updated default theme in others templating system Anyway, as OC2PS said, this is not a priority, we have a lot of things to do first but talking about it now is good for the future of the project Link to comment Share on other sites More sharing options...
Ralf Skirr Posted November 3, 2011 Share Posted November 3, 2011 I like to see smarty sent to the trash can too. I'm sure there are many more people who already know html and css, than people who already know smarty. Link to comment Share on other sites More sharing options...
Raphaël Malié Posted November 3, 2011 Share Posted November 3, 2011 Hi, I hate smarty (more than justin bieber), and I think PHP is the best / fastest / easiest / coolest template system, but today it's a too big modification to switch to an other template system. If we do that, all themes will be incompatible, all modules too, etc.. And seriously create an abstraction to use two template system is not the best solution, having one unique system is the best way to educate developpers to PrestaShop best practices. 1 Link to comment Share on other sites More sharing options...
Fabien Serny Posted November 3, 2011 Share Posted November 3, 2011 Hi Ralph, You can't do a template only in HTML and CSS. You need at least PHP to make it, and like I said, you will always have to learn how to make a theme (either Smarty or PHP). So your argument is irrelevant. NB : Everyone, don't listen to Raphael, he's just a crazy guy walking around in the office ^^ (More seriously, he's right about performance, but I don't agree with the coolest part ) Link to comment Share on other sites More sharing options...
OC2PS Posted November 3, 2011 Share Posted November 3, 2011 I agree with Whitelighter, it's not because one developer say, "you must have this feature and all people are agree with me", that he will be right (we can use the same argument against Whitelighter too ^^). I mean, Whitelighter said he want to keep Smarty, you said you want to have PHP template. It's the perfect example that we never got community satisfied this way. How can one of you be sure that a majority of developer is agree with you ? I think I'm a quite experimented developer, I will never say that a majority is agree with me, by the simple fact that I can be sure. The majority of developers I know are generally agree with me but I will never transform this fact in "a majority of developers is agree with me". I think the statement about developer preference is getting more attention than it deserves. Let's discuss the relative merits of PHP v templating engines. Forget for a moment that PS already has an installed base and existing infrastructure...if you were starting a project from scratch, what would you use and why? I think this type of thinking is key when setting longer term goals. Of course, if a decision is made that something aside from Smarty (nudge, nudge, PHP) is a better choice for a good system, then, as I said in an earlier post, that will obviously cause an unwelcome disruption if the change is made abruptly. And of course, PS will need to have a transition period and a gradual path from Smarty to the new system, in order to avoid the disruption and distress calls. But back to the issue at hand: PHP or templating engine? Link to comment Share on other sites More sharing options...
Fabien Serny Posted November 3, 2011 Share Posted November 3, 2011 I'm more for templating engine (it's only my opinion). PHP template are very attractive for me (again it's only my opinion ^^). But I can't denied the fact that PHP is far more performant. I think many developers in PrestaShop would prefer PHP templating (I'm thinking mostly about Raphael here ^^), but I'm not sure about the community. Lot of developers told me that they really like templating engine (twig, etc...), but I can't tell if it's the majority or not. I agree about the period of transition Link to comment Share on other sites More sharing options...
Julien Breux Posted November 3, 2011 Share Posted November 3, 2011 I'm ok with Fabien, i think that it's so difficult to keep compatibility with all! But the abstraction is THE solution. Because in my opignon, it's the role of community to give more more and more initiatives. You like Twig, I like Twig, let's do it and share with the community Link to comment Share on other sites More sharing options...
Raphaël Malié Posted November 3, 2011 Share Posted November 3, 2011 I don't really see the advantage to support twig for example. Pros : - You can use twig, so developpers who like twig are happy Cons : - All PrestaShop users (merchants, web designers, freelance, etc.) will have to learn twig if they want to change something on this theme Link to comment Share on other sites More sharing options...
Julien Breux Posted November 3, 2011 Share Posted November 3, 2011 @Raph, i'm ok with you and Rasmus. PHP is the better template engine but i like Twig inheritance. I really think that abstraction is a great idea. Because a soft that use two versions of Smarty like folders _v2, I never view Link to comment Share on other sites More sharing options...
Fabien Serny Posted November 3, 2011 Share Posted November 3, 2011 Ah ah Link to comment Share on other sites More sharing options...
Julien Breux Posted November 3, 2011 Share Posted November 3, 2011 @Raph / @Fab : I am willing to help you to abstract the view. Link to comment Share on other sites More sharing options...
Fabien Serny Posted November 3, 2011 Share Posted November 3, 2011 I'm for the abstraction too We have to speak with all core developers to see pros and cons. I don't think this will be for 1.5 anyway (too short time) Link to comment Share on other sites More sharing options...
Julien Breux Posted November 3, 2011 Share Posted November 3, 2011 I know :/ Link to comment Share on other sites More sharing options...
barry_k Posted November 3, 2011 Author Share Posted November 3, 2011 PHP is very easy to learn, very straight forward. HTML and CSS is also very easy. If we substitute one templating language for another we only create more problems. Transition away from all templating languages. Templates written in HTML/CSS can be combined with any web language out there, at the moment the templates require you to learn SMARTY but many web developers are familar with HTML/CSS for layout. Templating requires a learning curve. I have used many CMS before and everyone of them that uses a templating system has seen a lower amount of templates. I say this "WHY NOT MAKE THE NEXT MAJOR PRESTASHOP BUILD IN HTML/CSS with some PHP" see how it gets adopted by the community and if it doesnt work out then try something new. 1 Link to comment Share on other sites More sharing options...
Fabien Serny Posted November 3, 2011 Share Posted November 3, 2011 Hi Barry_K, I think you did not understand what we want to do. Making an abstract class won't be only for twig templating but for PHP templating too. And, we can't say just, change to PHP templating and let see what happened. What do you think the developers who have developed themes will say ? It will only kill the project. The only solution is to permit more template engine (or PHP templating) but to keep Smarty. Link to comment Share on other sites More sharing options...
barry_k Posted November 3, 2011 Author Share Posted November 3, 2011 All I say is look at the current templates available, they are all just a slight variation on each other. I am not saying switch from SMARTY to another templating language I am saying abandon templating all together and just call the necessary class as needed. One good example is the emeeting platform, no templating system only HTML/CSS and php classes. Have a look and let me know what you think of that platform. Link to comment Share on other sites More sharing options...
Burhan BVK Posted November 3, 2011 Share Posted November 3, 2011 I think the statement about developer preference is getting more attention than it deserves. Let's discuss the relative merits of PHP v templating engines. Forget for a moment that PS already has an installed base and existing infrastructure...if you were starting a project from scratch, what would you use and why? I think this type of thinking is key when setting longer term goals. Of course, if a decision is made that something aside from Smarty (nudge, nudge, PHP) is a better choice for a good system, then, as I said in an earlier post, that will obviously cause an unwelcome disruption if the change is made abruptly. And of course, PS will need to have a transition period and a gradual path from Smarty to the new system, in order to avoid the disruption and distress calls. But back to the issue at hand: PHP or templating engine? If you have a few php developers working on a project that no one else will ever have to modify, then you can get away with using php for templating. But if you have designers and other users who would like to make changes to the look and feel of the interface, then you need a template engine. A template engine has several advantages and very few drawbacks. The performance gain by using your own php templates is insignificant at best, with caching smarty does not cause much performance lack. Performance lost due to smarty is nothing compared to other bottlenecks in Prestashop. SQL subqueries, multiple css files, class overrides etc. These are all much more resource consuming than smarty. If you start with a PHP template, a few years from now you will end up with a smarty clone. First you will want to create a function space for templates, than you will want to simplify some of the syntax, then you will want some formatting functions for the templates, all of which are already in the smarty. And it is doubtful if you will gain anything performance wise. At the end of the day a template engine provides a good abstraction layer with few insignificant drawbacks. For a fresh project another template engine could be considered, but there is not much to gain from that at this point. Link to comment Share on other sites More sharing options...
OC2PS Posted November 3, 2011 Share Posted November 3, 2011 if you have designers and other users who would like to make changes to the look and feel of the interface, then you need a template engine. Why? Link to comment Share on other sites More sharing options...
OC2PS Posted November 3, 2011 Share Posted November 3, 2011 PHP is the best / fastest / easiest / coolest template system And seriously create an abstraction to use two template system is not the best solution, having one unique system is the best way to educate developpers to PrestaShop best practices. I totally agree with you Raphaël on both counts. By the way, while I have your attention, and since you are in charge of the multistore function, would you care to chime in at http://www.prestasho...ore-dont-do-it/ ? Especially curious to hear your thoughts on: Impact on performance for non-users Impact on development of new features and quashing of bugs Impact on complexity of code compared to single shop Impact on usability/interface for non-users Link to comment Share on other sites More sharing options...
mexique1 Posted November 3, 2011 Share Posted November 3, 2011 Hey, seems everybody agrees with me! So, I'm not alone Before changing the templating system / bringing a new one, IMHO the Prestashop team should work on sepating the V from the rest of the MVC I mean, in the MVC pattern, the View shouldn't have any idea of the Model. Some might say that the View contains the Model (the view variables), but I'm sure you understand me. This is what allows to change the View easily: the View can be HTML, CSV, PDF, Plain Text... while showing the same information. The View should be completely dummy and should not contain any logic, apart simple if/else statement for example. Currently, there's way too much logic in the templates ! Just look at product.tpl in the default theme: Apart from the fact that it is almost 500 lines long, it contains tons of logic about the price calculation, taxes, and so on... this is not the role of the View, those should have been processed before by the Controller ! --- Also, do you really think this is reliable to open a div in a template and close it in another template? Smarty argues that with its templating system, designers can work separately from developers... then explain me how ??? To work independently, the designer needs something like a stub model, and the templates need to be called in the order that PrestaShop calls them. This seems almost impossible. 3 Link to comment Share on other sites More sharing options...
Fabien Serny Posted November 3, 2011 Share Posted November 3, 2011 You're pointing out the problem. The problem is not smarty but it uses (opening a div in one template and closing it another one, too much logic in tpl, ...). If we change, or bring a new templating system, the problem will remain the same. I think the first work we should do before changing this is to improve smarty use in PrestaShop. For the use of Smarty to improve team work, there is not debate here. Each one can have his opinion. Link to comment Share on other sites More sharing options...
Ralf Skirr Posted November 5, 2011 Share Posted November 5, 2011 Hi Ralph, You can't do a template only in HTML and CSS. You need at least PHP to make it, and like I said, you will always have to learn how to make a theme (either Smarty or PHP). So your argument is irrelevant. I don't think so. Sorry for my overly simplistic words, let me rephrase. I'm sure there are more people who already know html and php and css, than people who already know smarty. Let me back this up: Pages in Google about PHP": 25,270,000,000 Pages in Google about "smarty": 24,600,000 Monthly searches in Google for PHP: 101,000,000 Monthly searches in Google for smarty: 673,000 Still irrelevant? Link to comment Share on other sites More sharing options...
Fabien Serny Posted November 5, 2011 Share Posted November 5, 2011 Hi, Sorry, I think I didn't write clearly (and I hope it didn't look too hostile :/ ) When I said the argument was irrelevant, I was not talking about the fact that we have to use PHP I was talking about the fact that even we do a PHP templating, people will still have to learn the functions and variables needed to make the template. Smarty is really not very difficult if you know how to code in PHP. The real issue here is what mexique1 said. We have to more separate view from model and make simplier template. And I have to admit I'm a bit afraid of PHP templating. I have recently seen a PHP template with MySQL query in it o_O I know, you can do it in smarty, but it's far more complicated to do it I think we should do two things. First, clean up the templates files to simplify them. Then maybe, open the templating system to other templating engines (or PHP templating). It's not sure. We are still talking about it in the team and it's not our priority for the moment. Edit : This post is my 1000th post on the forum \o/ 1 Link to comment Share on other sites More sharing options...
OC2PS Posted November 5, 2011 Share Posted November 5, 2011 I think we should do two things. First, clean up the templates files to simplify them. Then maybe, open the templating system to other templating engines (or PHP templating). It's not sure. We are still talking about it in the team and it's not our priority for the moment. The proper separation of concerns is very important (where V is only V), and you should think about doing it in near future. The templating engine discussion itself can be more longer term. Not sure if a ticket was needed, but have created one so that this doesn't get lost or forgotten http://forge.prestashop.com/browse/PSFV-194 This post is my 1000th post on the forum \o/ Does that make you a fanatic now? 1 Link to comment Share on other sites More sharing options...
Fabien Serny Posted November 5, 2011 Share Posted November 5, 2011 The proper separation of concerns is very important (where V is only V), and you should think about doing it in near future. The templating engine discussion itself can be more longer term. I totally agree with you. I'm not working on the front office on 1.5, I will discuss this with the developer in charge. For the templating engine discussion, as you said it will be more longer term, but we have to keep it mind. Does that make you a fanatic now? Apparently Link to comment Share on other sites More sharing options...
OC2PS Posted November 8, 2011 Share Posted November 8, 2011 I'm not working on the front office on 1.5, I will discuss this with the developer in charge. For the templating engine discussion, as you said it will be more longer term, but we have to keep it mind. Now that 1.5 RC1 has been pushed to January-end, do you think it might be worthwhile discussing with the concerned developers whether proper separation of concerns can be achieved in 1.5.0? Link to comment Share on other sites More sharing options...
Fabien Serny Posted November 8, 2011 Share Posted November 8, 2011 1.5 RC1 has been pushed to January-end in order to make a more stable release (not to add features or improvments). I don't think this will be for 1.5.0, but we will definitively work on that as soon as possible. Link to comment Share on other sites More sharing options...
philee Posted November 8, 2011 Share Posted November 8, 2011 I sure learned a lot about Smarty from this thread. Link to comment Share on other sites More sharing options...
johnme Posted November 9, 2011 Share Posted November 9, 2011 Please make old themes compatibility with latest 1.5 . So without waiting for theme Developers . we can upgrade new version hope prestashop consider this Link to comment Share on other sites More sharing options...
Fabien Serny Posted November 9, 2011 Share Posted November 9, 2011 Hi Johneme Do not worry, it's why we want to keep Smarty. Theme will stay retrocompatible between 1.4 and 1.5. But you have to be sure that your theme is working with Smarty 3. Link to comment Share on other sites More sharing options...
OC2PS Posted November 9, 2011 Share Posted November 9, 2011 1.5 RC1 has been pushed to January-end in order to make a more stable release I will go a bit off topic here (apologies). Does this mean that after 1st alpha is released, there are unlikely to be any changes in the theme, i.e. I can create a theme based off that code and expect it to work perfectly in 1.5.0? Link to comment Share on other sites More sharing options...
Fabien Serny Posted November 9, 2011 Share Posted November 9, 2011 Yes, it's our goal. And we will make possible to use 1.4 theme on 1.5 (for theme working with Smarty 3) Link to comment Share on other sites More sharing options...
OC2PS Posted November 9, 2011 Share Posted November 9, 2011 Thanks! Good to know. Link to comment Share on other sites More sharing options...
johnme Posted November 10, 2011 Share Posted November 10, 2011 wow . thanks for your reply How do i know . my theme is have smart 3 or not please tell me Link to comment Share on other sites More sharing options...
Fabien Serny Posted November 10, 2011 Share Posted November 10, 2011 Hi, If you're on PrestaShop 1.4, just go to Preferences tab. If the option "Use Smarty 2 instead of 3" is enabled, your theme will probably not work in 1.5. If the option is not enabled, your theme will certainly work in 1.5. Link to comment Share on other sites More sharing options...
MikaelPalmstedt Posted November 13, 2011 Share Posted November 13, 2011 Hi, We are looking to migrate and eventually switch a shop from Magento to Prestashop 1.5 since its to support multiple store views from now on. We will regardless do the initial development to migrate the store to get a hang of Prestashop. I was thinking to already start developing the theme based on 1.4 and 1.5 alpha release ... based on the comment above that should be no problem however after reading meixque's comment above I start getting second thought ... ? Better to wait until a later release? We are looking to launch a migrated shop mid of February. *totally agree that if you have logic in your theme (lol) starting with changing the template is soo not the right move. Link to comment Share on other sites More sharing options...
Fabien Serny Posted November 14, 2011 Share Posted November 14, 2011 You can continue, you should not encounter issue with the final release if you began the theme now. We will be compliant with 1.4 theme so 1.5 theme on the current release should work with the final release Link to comment Share on other sites More sharing options...
Timpet Posted November 15, 2011 Share Posted November 15, 2011 I like working in smarty, so plz dont remove it! Link to comment Share on other sites More sharing options...
xmurph Posted November 23, 2011 Share Posted November 23, 2011 partially agree and partially not: every progress has it's costs but every progress can be managed with use of brain: you want to remove smarty? (Also I think it's a progress in developement) ok do it with a programmed roadmap, communicate it to all Prestashop module developers, give a final release date, give adeguate time to developers to update to new platform, place the new version of Prestashop without smarty in a developer accessible directory, let they downloand install and test their modules/templaytes with new platform, and when all are ready...go out! the progress should be managed, never stopped... Removing smarty is probably the worst thing that can be done for Prestashop. Everyone thinks that everybody else wants the same features/changes they want. Everyday I see a ton of posts asking about a feature claiming that everyone wants it, that it is a necessary feature. The fact is, if you change smarty all of a sudden hundreds of modules and themes will have to be rewritten, a lot of people will not be happy all the old modules they have suddenly stopped working, and they would have to redo their old template etc. A shift from smarty to a different template system would drive a lot of people away, and still take too long. At then end you would have a portion of the user base Prestashop currently has, fewer people working to expand it. You would either end up with a similar template engine with not much technical advantage, or a php templating system with a lot of confused site owners and designers. Disadvantages grossly outweighs any advantage you might gain by removing smarty. As a developer, and a quite experienced and good one at that, I would use template engine even if this was new project. Using only php might be a good idea if only a few people are working on the same project. But prestashop is an open collaboration project, there are a lot of people with different skill levels working on the same code base. People who have no knowledge of php can still make minor modifications to templates without much effort. Smarty syntax is much less convoluted than php. 1 Link to comment Share on other sites More sharing options...
mexique1 Posted November 23, 2011 Share Posted November 23, 2011 A funny quote about that : “I’ve finally learned what ‘upward compatible’ means. It means we get to keep all our old mistakes.” (Dennie van Tassel) 1 Link to comment Share on other sites More sharing options...
OC2PS Posted November 23, 2011 Share Posted November 23, 2011 “I’ve finally learned what ‘upward compatible’ means. It means we get to keep all our old mistakes.” (Dennie van Tassel) Funny, because it's true Link to comment Share on other sites More sharing options...
shacker Posted November 24, 2011 Share Posted November 24, 2011 smarty is really easy to use, and performance in presta 1.4.5 its very good. Link to comment Share on other sites More sharing options...
PrestaShopDeveloper Posted November 24, 2011 Share Posted November 24, 2011 They can't just remove Smarty and it doesn't make PrestaShop slow. I've worked with a lot of products that use Smarty and they are just rapid. BTW if we compare Smarty 2, Smarty 3 and Dwoo (compatible with Smarty) - Dwoo shows the best performance, the next one is Smarty 2 and with the lower performance is Smarty 3. If you've tested PrestaShop 1.5.0.1 you'll see that it's way slower than 1.4. I had pageloads of 17 seconds at the BackOffice on my local machine. Link to comment Share on other sites More sharing options...
mexique1 Posted November 24, 2011 Share Posted November 24, 2011 Maybe Smarty doesn't make PrestaShop slow, but it doesn't make PrestaShop fast... Most of what you can do to fasten your site is on the database layer, not on the presentation layer. Even the worst template engine in the world won't affect your performance the same way than database tables without indexes... Link to comment Share on other sites More sharing options...
Fabien Serny Posted November 28, 2011 Share Posted November 28, 2011 That's why we working on other performances issues. Back office in 1.5 should be quicker now (except modules administration page on wamp only) but we are still working on it. I think before thinking about removing smarty, we must work on two things (and Mexique1 wrote about it) : - Improve database and code performance - Cleanup smarty template (that way it will be easier for designer and integrator to work with it. 1 Link to comment Share on other sites More sharing options...
OC2PS Posted November 28, 2011 Share Posted November 28, 2011 Cleanup smarty template +1 As for performance, there's a lot more that can be done: Cache as static: http://forge.prestashop.com/browse/PSFV-102 Smush images: http://forge.prestashop.com/browse/PSFV-99 Store images in subdomain: http://forge.prestashop.com/browse/PSFV-106 Use Google libraries: http://forge.prestashop.com/browse/PSFV-101 Use CSS sprites for theme images, icons etc: http://forge.prestashop.com/browse/PSFV-120 Concatenate CSS and JS: http://forge.prestashop.com/browse/PSFV-105 (partly already possible) Minify: http://forge.prestashop.com/browse/PSFV-100 (partly already possible) 1 Link to comment Share on other sites More sharing options...
Fabien Serny Posted November 28, 2011 Share Posted November 28, 2011 I think there is much more to do before doing the improvments you described. Link to comment Share on other sites More sharing options...
prestamax Posted December 4, 2011 Share Posted December 4, 2011 I don't mind smarty but would appreciate some more documentation about smarty and prestashop. Link to comment Share on other sites More sharing options...
Fabien Serny Posted December 5, 2011 Share Posted December 5, 2011 Hello prestamax, http://doc.prestashop.com Link to comment Share on other sites More sharing options...
prestamax Posted December 5, 2011 Share Posted December 5, 2011 Hi Fabien, thanks ... yes I know the docs. They are helpful but contain mainly basic infos. What I would like to see is a documentation containing more advanced infos such as: what globals are available and can be used in a theme file. Or how to change sort order of featured products and infos like that. I could find some useful posts in the forum but it would be great if there was some kind of codex for these infos. Link to comment Share on other sites More sharing options...
Fabien Serny Posted December 5, 2011 Share Posted December 5, 2011 Yes I agree, but it's hard for us to think about all possibilities. We will complete the documentation with time Link to comment Share on other sites More sharing options...
prestamax Posted December 5, 2011 Share Posted December 5, 2011 It's not only about possibilities but also about seemingly missing logic. For example if I want to change the structure of a theme I can move the hook $HOOK_RIGHT_COLUMN to the footer region but I can't move it to the left sidebar. And it's somewhat frustrating if you can't find any documentation about the logic behind this behaviour. Link to comment Share on other sites More sharing options...
Fabien Serny Posted December 6, 2011 Share Posted December 6, 2011 You won't have this issue in 1.5, you will be able to execute Hook in your tpl {hook h='displayRightColumn'} 1 Link to comment Share on other sites More sharing options...
prestamax Posted December 6, 2011 Share Posted December 6, 2011 good to know .. thank you! p.s. just thinking about it ... wouldn't it be good if such changes could be dropped in some kind of code snippet pool so that everybody could be informed about it? Link to comment Share on other sites More sharing options...
Fabien Serny Posted December 6, 2011 Share Posted December 6, 2011 It will. I will write a complete article about modules modification in 1.5. 1 Link to comment Share on other sites More sharing options...
mexique1 Posted December 12, 2011 Share Posted December 12, 2011 I promised it, I did it For those still interested in an alternative to Smarty, check out Oops : http://www.prestashop.com/forums/topic/145845-tools-oops-a-framework-for-prestashop/ It allows to use pure PHP templates with the help of Zend MVC. https://github.com/alexsegura/Oops Check it out !!! Link to comment Share on other sites More sharing options...
El Patron Posted December 17, 2011 Share Posted December 17, 2011 Hi, Anyone else hate the smarty templating language as much as I do? I think prestashop should move over to CSS and HTML5 templating instead. I understand why SMARTY is used for projects but I find it actually complicates things. Anyone else agree? It's not healthy to hate inanimate things. I'm actually writing my thoughts here so as to prolong creating yet another form. I agree with you on why PS probably choose the smarty path. Are there better form engines than smarty?...probably but I'd bet 2.000 cops they proprietary. What I would love to see is more web2.0, forms, don't leave the page. Pop that form right up there, this IMHO really engages the customer. One capability that would make life easier for a lot of us is a way to edit smarty templates in dw design view. If anyone knows an extension for that...I'd love to hear about it. I've begun to realize that placing .tpls in the active template creates some real headaches for development, well unless you just develop templates. A .tpl override folder please. happy forming Link to comment Share on other sites More sharing options...
Fabien Serny Posted December 18, 2011 Share Posted December 18, 2011 Hi elpatron, I assure you that we are not proprietary of smarty In fact, we are keeping smarty to keep retrocompatibility to themes. As I said in the topic, the real problem is not smarty, the real problem is that there is too much logic in our smarty code. We could have done the templating with any other engines (twig, oops, or even PHP), having too much logic in templating code make creating a new theme something very difficult. We are working on having less logic in our template. Link to comment Share on other sites More sharing options...
El Patron Posted December 18, 2011 Share Posted December 18, 2011 Hi fabien, thanks for the response, I meant any other alternative but smarty as a choice, was probably proprietary... as it concerns code in smarty...I hear tell 1.5 will allow us to put code in email...jajajajajaja I did find a dw extension that makes working with smarty a little better in DW...but no real design mode http://download.cnet...4-10393553.html Link to comment Share on other sites More sharing options...
Fabien Serny Posted December 19, 2011 Share Posted December 19, 2011 Smarty will be use in the BO and for the PDF invoice too Link to comment Share on other sites More sharing options...
OC2PS Posted December 29, 2011 Share Posted December 29, 2011 problem is that there is too much logic in our smarty code. We could have done the templating with any other engines (twig, oops, or even PHP), having too much logic in templating code make creating a new theme something very difficult. We are working on having less logic in our template. Do you have any targets and timelines in mind as you work towards cleaning up the templates? http://forge.prestashop.com/browse/PSFV-194 Link to comment Share on other sites More sharing options...
Fabien Serny Posted December 29, 2011 Share Posted December 29, 2011 I don't think it will be done in 1.5. Just opening and closing tag in the same tpl won't be such an improvment, we have to do more improvments on templating system, we are currently working on it but we don't want to do something quick and instable to release it in 1.5. Again, this is NOT a bug, only a improvment (important improvment I agree, but not a bug ) Link to comment Share on other sites More sharing options...
OC2PS Posted December 29, 2011 Share Posted December 29, 2011 Not a must to have it in 1.5.0, but I think it helps to have a target in mind....1.5.1? 1.5.2? Also helps to have an "owner" assigned to it. Link to comment Share on other sites More sharing options...
Fabien Serny Posted December 29, 2011 Share Posted December 29, 2011 We will try to respect release cycle now. We won't add major improvement between small versions. This improvment deserve a huge work (as I said, we really want to improve it in many ways). I think it will be more for 1.6 than 1.5.1 (edit : it is not something official yet) Don't worry, the people assigned on it will be owner soon. For the moment, our priority is make the 1.5 stable. Link to comment Share on other sites More sharing options...
OC2PS Posted February 1, 2012 Share Posted February 1, 2012 http://www.prestashop.com/forums/index.php?/topic/153179-prestshop-15-production-ready-release/page__view__findpost__p__743640 we moved all the HTML in ~100 controllers into smarty templates Does this mean you have already fixed this in 1.5 or is Raphaël talking about something entirely different? Link to comment Share on other sites More sharing options...
svetaines1 Posted February 7, 2012 Share Posted February 7, 2012 From all people of that topic, mexique1 mostly clear discover the problem. At the moment Prestashop themes so hard editable, because of mess in the templates structure and code. Also smarty doesn't make templating easier for non skilled users like me. From the point of web designer view with little knowledge of PHP, learn language (which I will use only with PS) is big luxury. Everyone know, what it is better to be specialist in one area, instead of knowing many things superficially So I hope one day Prestashop refuse Smarty templating and will use only PHP, HTML and CSS for they templates. I believe the number of community templates will grow up numerous times Also, it will be great if Prestashop team make Poll regarding future template systems. It will be really interesting to see, what community wants Link to comment Share on other sites More sharing options...
shacker Posted February 7, 2012 Share Posted February 7, 2012 replace smarty t ophp is the same for users that dont have knowledge. Is the same to take a theme in wordpress and try to modify. Have html code (smarty too) and if you dont know php, really are lost. FOr smarty the code is simply if you know php. So, users with less knowledge, is the same a site in php+html or smarty, becouse if dont know they need to learn. Link to comment Share on other sites More sharing options...
Raphaël Malié Posted February 7, 2012 Share Posted February 7, 2012 @OC2PS : no this is something different, we just moved the HTML in admin files to smarty templates. Only for the BO. @shacker : I disagree, Smarty is not simple even if you know PHP. For example, if you want to use a PHP array in a PHP function call, you have to use [] syntaxe ... E.g. {$link->getModuleLink('test', 'test', ['this', 'is', 'stupid', '!'])} 1 Link to comment Share on other sites More sharing options...
Fabien Serny Posted February 7, 2012 Share Posted February 7, 2012 I think everybody will understand that Raphaël do not like Smarty 1 Link to comment Share on other sites More sharing options...
shacker Posted February 7, 2012 Share Posted February 7, 2012 yep, its clear jajaja Link to comment Share on other sites More sharing options...
svetaines1 Posted February 7, 2012 Share Posted February 7, 2012 replace smarty t ophp is the same for users that dont have knowledge. Is the same to take a theme in wordpress and try to modify. Have html code (smarty too) and if you dont know php, really are lost. FOr smarty the code is simply if you know php. So, users with less knowledge, is the same a site in php+html or smarty, becouse if dont know they need to learn. Not sure .. Is it big difference to learn one language or two? For me yes! I am sure for many users too.. Time moves only forward and it will be great not waste it on unnecessary things. As for me, not skilled user, I feel more comfortable with PHP even if my knowledge is quite superficially. As I wrote before, majority vote is most important. If I am belong to minority, then I will shut up Link to comment Share on other sites More sharing options...
OC2PS Posted February 7, 2012 Share Posted February 7, 2012 Smarty is not simple even if you know PHP. For example, if you want to use a PHP array in a PHP function call, you have to use [] syntaxe ... E.g. {$link->getModuleLink('test', 'test', ['this', 'is', 'stupid', '!'])} Hear, hear! 2 Link to comment Share on other sites More sharing options...
OC2PS Posted February 7, 2012 Share Posted February 7, 2012 Is the same to take a theme in wordpress and try to modify. Have html code (smarty too) and if you dont know php, really are lost. There's 3 critical, massive differences in WordPress: Customizable themes: There are numerous themes, including default theme, that are greatly customizable from the admin panel itself. No need to dig into the code AT ALL. http://forge.prestashop.com/browse/PSFV-42 Child themes: If you like a theme, but want to customize a small piece of it, you don't copy the theme and start over. If you did, you'd stand to lose any advances in the theme, including bug fixes, security fixes, feature additions, compatibility releases, etc in the future. Instead, what you do is that you create a child theme, and only tweak the part that you want to change. This way, you can keep updating your theme without losing the customizations. http://codex.wordpress.org/Theme_Development#Child_Themes This is possible because you are merely changing the CSS, which accounts for 95% of all theme customization requirements. Did you just say WordPress uses Smarty? Because that's simply not true. 1 Link to comment Share on other sites More sharing options...
shacker Posted February 7, 2012 Share Posted February 7, 2012 i say that in smarty, you have HTML code too (like in worpress themes-not wordpres use smarty), and for basic things you can modify like wordpress. ANd you can make modifications on prestashop using only CSS. The point if when you need to customize much more, not only html, becouse that is easy. Link to comment Share on other sites More sharing options...
Fabien Serny Posted February 8, 2012 Share Posted February 8, 2012 Hi OC2PS, You can't compare PrestaShop and Wordpress, because it's just not the same thing. Wordpress is a CMS. It's normal that their theme manager is very complete and powerfull. PrestaShop is a shop, I don't say that we don't want to work hard on template, I just say that we have many features to handle with (price, stock, sales, ...). Features that wordpress do not have to handle with. Yes. I know. There is a wordpress e-commerce plugin. But it doesn't handle as much functionnalities that we are. Merchants asked more for new features rather than complete system manager. In fact, no one asked for it beside you (I'm not talking about the smarty part, I'm talking about your ticket here : http://forge.prestashop.com/browse/PSFV-42) :-) Best regards, Link to comment Share on other sites More sharing options...
prestamax Posted February 8, 2012 Share Posted February 8, 2012 I would suggest to remove inline styles from the smarty templates such as for example in homefeatured {assign var='liHeight' value=342} {math equation="nbLines*liHeight" nbLines=$nbLines|ceil liHeight=$liHeight assign=ulHeight} <ul style="height:{$ulHeight}px;"> A better more professional way would be giving the ul and it's content classes and assigning the values in the css file. There is no need assigning it this way. 1 Link to comment Share on other sites More sharing options...
shacker Posted February 8, 2012 Share Posted February 8, 2012 fully agree with this. ANd some layouts have table (need to be replace with divs) 1 Link to comment Share on other sites More sharing options...
Raphaël Malié Posted February 8, 2012 Share Posted February 8, 2012 +1 / I like on Prestamax message The front office theme structure should (will !!!) be reworked completly in 1.6. I really hope we can do this without any compatibility problems. Link to comment Share on other sites More sharing options...
OC2PS Posted February 9, 2012 Share Posted February 9, 2012 You can't compare PrestaShop and Wordpress, because it's just not the same thing. I understand they are different; I was just responding to shacker's comment (as you can see I quoted it before replying), in which he had invoked WordPress. That being said: i) Being a blogging platform and CMS doesn't mean WordPress is not complex or sophisticated. It has to handle hierarchical pages, chronological posts and nested comments. Like PS it handles multiple user roles but also allows plugins to create additional roles. Multiple URL formats, flexible landing page possibilities, customizable snippet views, comment moderation, granular control on comments, video and image media handling, multiple widgets, multiple layouts, automatic core/plugin/theme updates, import content from other systems, theoretical handling of more variables than PS because it allows custom variables. And all that without any plugins. Now think about all the flexibility provided to the plugins, including numerous hooks, custom post types, custom taxonomies and custom variables...and we get plugins for everything from Facebook/Google/Twitter login to fully functional event & appointment calendar to a forum/bulletin board system. There are even plugins to white-label WordPress. Yes, I've heard all the criticisms from techies. But there is a reason WordPress powers 15% of the sites in the world. It is easy-to-use (you don't have to be a techie to install, customize and use it), flexible/powerful and extensible. ii) Just because WP and PS are different doesn't mean that good ideas can not be acknowledged and adopted. Having multiple widget areas and treating everything as a widget that can be dragged and dropped there is one such idea. Having different page layouts for different page types is another such. There is a wordpress e-commerce plugin. But it doesn't handle as much functionnalities that we are. Actually, there are several WordPress eCommerce plugins. And they play well with WordPress themes and plugins (including multisite, by the way). It's true they don't have as many features as PrestaShop yet (while in some areas they have more features than PrestaShop simply because they are part of WordPress). But you better watch out and keep up, because they are developing fast! no one asked for it beside you http://forge.prestas.../browse/PSFV-42 Umm...on that ticket link, I see 19 votes and several favorable comments. The only feature with more votes is Guest Checkout process redesign http://forge.prestas.../browse/PSFV-47 More importantly, as Innovator's Dilemma tells us, you have to balance what your current customers want with what a larger base of prospective customers may need to become customers. 2 Link to comment Share on other sites More sharing options...
Recommended Posts