Welcome Guest, Not a member yet? Register   Sign In
template engine?
#11

(This post was last modified: 06-14-2016, 12:38 PM by PaulD. Edit Reason: added quote )

Quote:I am not a designer, but I got to hate writing PHP-views. :-) Although PHP is thought as a template language, as such it is a failure, I think.

Here is what I can say:

1. A specialized template language is needed, nevertheless how designers feel comfortable with PHP. Even, it could be partially portable outside PHP-systems.

2. CodeIgniter's policy about escaping has changed, escaping should be at output. A template engine with enabled by default HTML-escaping would give comfort in this situation. Otherwise it is not certain how carefully view's PHP code would be written. Built-in escaping for other contexts as HTML-attributes, JavaScript, etc. could be handy too.

3. A sophisticated template engine adds more value to programming than just arrangement relationships between programmers and designers. Seek for block-support, blocks could be defined in an abstract way and placed and moved wherever you like in your master template, a concrete controller can fill them with the concrete information.

A good template engine will allow you to clear your controllers from any visual design aspects - this is not achieved by me yet, due to maintaining BC, but it is achievable.

4. The CI3 built-in parser is quite minimalistic, it does not add significant value in comparison with the pure PHP-views. Better don't waste your time with it. Carefully pick up a third-party template engine and integrate it within your application.

Hi,

In comment to your points:

However php started, it is so much more than a template language now. That is like saying windows is just a way to access my files.

1. It might be needed, it might not. Some projects will benefit, others won't.

2. It may have changed. But I now see why data should be escaped on output. It makes alot of sense to me now.

3. Pure php gives the full power of php to views. A template engine will always have limited application of these things. However a template engine can offer block support, theming etc. but they all offer different benefits. Pre-defining a template engine in the framework would be wrong. Controllers are always free of design considerations, well at least mine are.

4. You are right. The built in template parser is not something I have actually ever used because of this. I think it should be deprecated in CI4.

Templating systems are so diverse and numerous, to be forced to use one like laravel does with twig, is in my opinion, verging on ridiculous. My framework of choice should not be telling me what templating system, shopping cart, file upload, forum, blog, authorisation method, database or image gallery I should use. That is up to me, surely, and my choice will not be the same as your choice for any of them.

CI does not do any of this to me, which I why I love using it.

Paul.
Reply


Messages In This Thread
template engine? - by winers1290 - 05-25-2016, 06:33 PM
RE: template engine? - by skunkbad - 05-25-2016, 06:54 PM
RE: template engine? - by winers1290 - 05-26-2016, 02:58 PM
RE: template engine? - by InsiteFX - 05-27-2016, 03:31 AM
RE: template engine? - by winers1290 - 05-28-2016, 03:07 AM
RE: template engine? - by cartalot - 05-27-2016, 12:55 PM
RE: template engine? - by Paradinight - 05-28-2016, 08:22 AM
RE: template engine? - by cartalot - 05-28-2016, 12:21 PM
RE: template engine? - by marksman - 06-14-2016, 08:06 AM
RE: template engine? - by ivantcholakov - 06-14-2016, 10:37 AM
RE: template engine? - by PaulD - 06-14-2016, 12:37 PM
RE: template engine? - by ivantcholakov - 06-15-2016, 04:17 AM
RE: template engine? - by spjonez - 06-15-2016, 05:31 AM
RE: template engine? - by prezire - 06-15-2016, 05:43 AM



Theme © iAndrew 2016 - Forum software by © MyBB