|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
bimal Smarty Elite
Joined: 19 Apr 2007 Posts: 423
|
Posted: Fri Jan 21, 2011 10:09 pm Post subject: If you’re smart, don’t use Smarty - Wrong! |
|
|
First please look at the post:
http://codesanity.net/2010/06/dont-use-smarty/
The author seems to be a codeigniter expert.
Wrongly coded applications will be always slower in whatever faster application you will use. Overloading smarty object with a lot of assigns, template based programming, etc. will case a system slow.
While developing a large scale application, thinking about the server resources, execution times, etc. are not the primary duties of a programmer or a designer. Further, low scale private networked applications will never raise performance issues again.
I personally feel that it is not a good idea to hang around the PHP templates again; while debugging the design issues. Nor to copy/paste the PHP codes block in each new template to create.
They always talk about working with designers; while complaining Smarty.
But forget the idea of separating the business logic from the designs.
Problems of speed and performance arise only after a small team of developers taking care of big responsibilities in a small time frame; and messing things up. The faster you tend to complete a project, more the problems residue.
Is it still good to design a system where the template holds a part of application's business logic? |
|
Back to top |
|
uffeUtvecklare Smarty Rookie
Joined: 23 Feb 2011 Posts: 8
|
Posted: Thu Mar 03, 2011 11:15 am Post subject: Re: If you’re smart, don’t use Smarty - Wrong! |
|
|
bimal wrote: |
Is it still good to design a system where the template holds a part of application's business logic? |
I have recently been hired as a developer at a company using smarty for their template engine for the main company product. The PHP code and even some of the smarty-templates are coded in a halfassed-fashion, wich results in alot of fiddling and weird solutions everytime the system is being deployed to a new customer.
As I'm new to coding for food(see: working as a developer) I haven't had too much experience with larger systems and 3 months ago I didn't know a thing about smarty. So when deadlines are closing in and you HAVE to solve problems now, I accept alot more businesslogic in smarty-templates. As long as you don't over do it I personally thinks this works fine for smaller projects.
I don't think this is the way to go when you plan your code however, everything works better if most of the processing is made behind curtains.
My final answer will be: Yes, it is fine to have a little business-logic in your template. |
|
Back to top |
|
pitbull82 Smarty Rookie
Joined: 01 Feb 2006 Posts: 18 Location: Poland
|
Posted: Wed Mar 23, 2011 7:38 am Post subject: |
|
|
I think one of the biggest problems is Smarty performance. When you look at http://www.phpcomparison.net/ or http://www.raintpl.com/PHP-Template-Engines-Speed-Test/ you'll see that smarty in that comparision is the slowest and the most memory consuming template engine. I hope that in nearest future it will change.
Most basic smarty usage:
Code: | $x = new Smarty();
$x->template_dir = 'application/View';
$x->compile_dir = 'application/View-Compiled';
$x->compile_check = false;
$x->assign('content','Komponent content');
$site = $x->fetch('index.tpl'); |
and index.tpl
Code: |
<html>
<head>
<title>Info</title>
</head>
<body>
{$content}
</body>
</html> |
uses 701.578 kB whereas core of my aaplication (including router/dispatcher/front controller/config class/benchmark) consumes less then 300 kB |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|