Re:Comparison with Other Frameworks
by raboukhalil on Saturday October 22, 2016 @11:21AM
(#12769020)
PHP also offers a nice way to write templates without even having to use echo and without braces:
[ Parent
| on HN ]
Re:Comparison with Other Frameworks
by combatentropy on Saturday October 22, 2016 @01:45PM
(#12769675)
Yes, that's what I do. I also think it's fine to use omit trailing semicolons and to use short-open tags (I already labelled the file .php --- why do I have to keep saying "php" all over it? And I'm not usually outputting XML.)
<? foreach($x as $y): ?>
<h1><?= h($y->title) ?></h1>
<? endforeach ?>
You just want to make sure to escape all output with htmlspecialchars, or define a shorter function like I did ("h").
Re:Comparison with Other Frameworks
by raboukhalil on Saturday October 22, 2016 @04:48PM
(#12770495)
I agree!
Re:Comparison with Other Frameworks
by bluejekyll on Saturday October 22, 2016 @11:31AM
(#12769066)
PHP can only be used serverside, no? Can't write single page apps.
You can't do SPAs with ajax calls?
Re:Comparison with Other Frameworks
by bluejekyll on Saturday October 22, 2016 @10:47PM
(#12771623)
Huh? I'm asking how with PHP. You would write a 100% client side app.