Modify template rendering so that it's still in a familiar language (php) but without needing to write php with php.
PHP tags in the template are effectively ignored. The new template with the new render logic generates the same output (more or less) as the existing template with the existing code.
<% ... %> contains templating logic, become php tags when processing the template <?(php|=) ... ?> considered raw text when processing the template
The proposed syntax doesn't remove the need to program though. Its still just PHP with all the good/bad parts.
Twig while different has several measurable advantages both in terseness and features provided.I think the biggest gain from using erb style delimiters is that templates that generate PHP code are much simpler to grok than before.
I think it is a net win in that situation. I see no reason to use this template style in view templates unless there was a more compelling reason. The most compelling reason I can think of is auto-escaping. This is sorely lacking from CakePHP and would be one of the many reasons I would consider suggesting CakePHP use Twig or another standalone templating system.
Would it not be better to change variable echoing to be <%= $variable %> or <%= variable %> instead of the present approach?
As I read back on that comment, I realize that I'm just getting old, as the comment sounds like one of those people that resists change, just because it's change. While CakePHP might be a playground I'm welcome to play in and contribute to, I've it's not my play equipment alone, and I've got to share.So, just to recap, no one wants to write the following in a bake template:<?php echo '<?php echo $data[\'' . $model->alias . '\'][\'id\']; ?>'; ?>Specifically, it's the inner php statements that are annoying, and can get confusing.So, the first suggestion is to use erb style delimiters or similar to make help distinguish the php for the bake, and the php for the generated template:<?php echo '<%= $data[\'' . $model->alias . '\'][\'id\']; %>'; ?>
<?php echo $data['<%= $model->alias %>']['id']; ?>
You received this message because you are subscribed to a topic in the Google Groups "cakephp-core" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cakephp-core/plAK5Hof4ls/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cakephp-core...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.