Monday, January 20, 2014

Re: Will combining cakephp with web templates like Smarty or Twig make front-end coding easier?

It depends on who's programming your View layer.

If the developer, who is also programming the Controller and Model layers, is doing the View, then go with your preference.  I already know PHP, so using the FormHelper doesn't scare me, and sometimes learning another syntax for the sake of it gets annoying.

However, your Viewer layer coder may be a designer who is used to working with Smarty or Twig, and may not be familiar with the PHP.  The designer may have used a platform agnostic template engine from other languages like Ruby or ASP.NET MVC, so for them, using Smarty or Twig or any other template engine may be best.

And then you've got the case of the client side UI that just uses REST/JSON from the MVC, and uses Javascript UI and MVVM for client side generated UIs only.  That's a solid case for a view template engine that doesn't care about the server technology at all.

On Tuesday, 21 January 2014 09:30:00 UTC+10, Sam wrote:
I am doing some reading. Here is one thing that puzzles me. One advantage of web template engines is that they separate presentation and logic. The same can be said about MVC frameworks like Cakephp. Then, why do we combine both together since any single one can do the separation? Did I miss out something? What are the pros and cons? 

On Monday, January 20, 2014 11:45:33 PM UTC+8, José Lorenzo wrote:
It helps to some extent, specially keeping the views safe from XSS attacks. Some would argue that it does not make your views more readable, I think it is a matter of preference. Here you have a CakePHP plugin for working with Twig:

https://github.com/WyriHaximus/TwigView

On Monday, January 20, 2014 4:32:03 PM UTC+1, Sam wrote:
Cakephp is good for back-end work. Web templates like Smarty or Twig is used for front-end work. Will combining cakephp with web templates like Smarty or Twig make front-end coding easier? Is this advisable and has it been done before?

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: