Welcome Guest, Not a member yet? Register   Sign In
Better Template Engine

(This post was last modified: 03-05-2015, 10:12 AM by mwhitney.)

Honestly, if someone calls themself a "web developer" and can't handle a little inline PHP, they need a new job title. This is why we have "web designers" and "front-end developers", to cover the middle ground between "web developer" and "graphic designer" (and I would say that assuming a "graphic designer" can do styling and layout for a website is dangerous ground). Additionally, it takes almost as much time to explain to some people what {firstname} means in the middle of the HTML as <?php echo $firstname; ?> (never mind some of the more complicated features of some templating tools).

Personally, I just do my best to limit the PHP used in a view to the simplest possible PHP, usually equating to what's commonly supported in templating languages (echo, foreach, if/else). When I run across a view which is overly complicated for some reason, I try to refactor it by first moving as much of the PHP as possible to the top (our web designer will skip any block of PHP at the top unless the text that needs to change turns out to be in a variable instead of being directly in the view), then moving it to the controller (and, eventually, off to wherever it really belongs).

So far, it has been far more difficult for our web designer to access and use our version control repository and determine where to find the view for a given page (or portion of a page) than to handle our use of PHP in views. I think this may be more universal than most people believe.

That said, it's certainly understandable in some situations that a templating language would be preferable for views over raw PHP. I also find that templating tools act as a reinforcement of the otherwise self-enforced limitation on the use of PHP in views, which can make them very useful in some environments.

As for the original question/request, CI can't provide the perfect solution for everyone. In most cases, it does its best to supply the basic tools for the job, then gets out of the way. It's fairly easy to implement any number of templating tools in CI, so there has been little reason for the CI community to extend the functionality of the basic parser which is included by default. Most people who prefer to use templating tools already have a library they prefer and they can use that library with CI (unless it happens to have been written for some back-end language other than PHP).

Messages In This Thread
Better Template Engine - by Tux - 03-03-2015, 12:48 AM
RE: Better Template Engine - by tapan.thapa - 03-03-2015, 12:58 AM
RE: Better Template Engine - by tapan.thapa - 03-03-2015, 01:09 AM
RE: Better Template Engine - by spjonez - 03-03-2015, 08:14 PM
RE: Better Template Engine - by sv3tli0 - 03-04-2015, 02:46 AM
RE: Better Template Engine - by Maximw - 03-04-2015, 04:38 PM
RE: Better Template Engine - by ciadmin - 03-04-2015, 05:26 PM
RE: Better Template Engine - by mwhitney - 03-05-2015, 10:12 AM

Theme © iAndrew 2016 - Forum software by © MyBB