3 ms·
I'm not sure why you believe that it is necessary to do stuff like <?=$varname;?>. Certainly, a competent PHP programmer can use file operations and str_replac
by jbm 17y ago
I'm not sure why you believe that it is necessary to do stuff like <?=$varname;?>. Certainly, a competent PHP programmer can use file operations and str_replace to do templating; it's pretty much what I do right now. The template for a dog-related site I'm working on looks like this:
<div class="dog" id="dog_{{__id__}}">
<h1 class="name">{{__name__}}</h1>
<p class="sex">{{__sex__}}</p>
<p class="breed">{{__breed__}}</p>
<p class="images">{{__pictures__}}</p>
<div class="description">{{__description__}}</div>
</div>
(The formatting appears to be lost; accept my apologies)
That said, I am also working on fixing a restaurant site that a friend programmed, and it is littered with the type of disgusting syntax you mention. It's the difference between a designer who does snippets of PHP and a programmer.
- randallsquared 17y agoYou're not arguing against me, but with me. ;) The article suggested that it was obviously a bad idea to write a templating engine in PHP, since PHP is already in the category of "templating engine". As you point out, it's easy to implement a template system in PHP that's better to use than raw PHP would be.