Smarty in CI

If I am both the developer and designer of a site, is there any benefit to using a template engine like Smarty in an MVC framework like CI? Doesn't the "V" provide enough separation of concern?

The benefit of a template engine for a designer is that he/she sees all the html in wysiwyg mode. If you have php in your views they will only see it as one tag and if the php code has html elements the design could break because they didn't see it.

So if you are developer and designer a template engine isn't necessary, you can always add it later.

Aside from trying to keep it less confusing for the designer, isn't there a benefit there somehow?

[eluser]Sam Dark[/eluser]
Not really…

How about these benefits listed on Smarty's site (see:

Caching: Smarty provides fine-grained caching features for caching all or parts of a rendered web page, or leaving parts uncached. Programmers can register template functions as cacheable or non-cachable, group cached pages into logical units for easier management, etc.

Security: Templates do not contain PHP code. Therefore, a template designer is not unleashed with the full power of PHP, but only the subset of functionality made available to them from the programmer (application code.)

Compiling: Smarty compiles templates into PHP code behind the scenes, eliminating run-time parsing of templates.

Performance: Smarty performs extremely well, despite its vast feature set. Most of Smarty's capabilities lie in plugins that are loaded on-demand. Smarty comes with numerous presentation tools, minimizing your application code and resulting in quicker, less error-prone application development/deployment. Smarty templates get compiled to PHP files internally (once), eliminating costly template file scans and leveraging the speed of PHP op-code accelerators.

[eluser]Sam Dark[/eluser]
Yes. Smarty's caching is very flexible. I want to see something like it in CI.

If you are serious about letting designer to edit templates — yes. It's a benefit. But I don't think it's a good idea.

Compiling and Performance
Yes, it comples a lot of templates to one php-template. But even using this it checks if template compliled and loaded itself. So there is still some notable overhead.

Caching is provided by CI.
Security you don't need because you are the designer and developer.
If you add smarty to CI you create an extra layer for your view files, pure php is always faster.
Compiling seems to be another way of caching, if i'm not mistaken.

Edit : Sam beat me Smile
True the CI caching isn't very advanced but there are advanced cache libraries.

So, are those reasons enough to also include Smarty in a CI project?

Ugh. My last comment was for Grad Student, not for Lab Technician.

So, I am leaning against using Smarty. Is this a good idea?

[eluser]Sam Dark[/eluser]
xwero, CI's native view caching is a toy copared to Smarty's.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.