Kroc/DOMTemplate

`html` should be a property, not a method

Closed this issue · 2 comments

Kroc commented

Getters / setters are ugly in PHP, but nevertheless, html should be a property and not a method because it can't be chained to anything.

nkrs commented

Why name it html? From what I know, the engine itself can be used for XML too (and XML-based formats like RSS, Atom, OPML and such). Perhaps naming the property output or document would be a better option.

Kroc commented

DOMTemplate is an HTML templating engine. You can do XML yes, but the whole point is that you are—in the grand scheme of things—always making a website, or you wouldn’t be using PHP.

Secondly, html changes the XML source to work with browsers. Therefore what you get is HTML and not just XML. I intend to extend the feature further, such as replacing comment hiding markers. I.e. what you get out of DOMTemplate’s html is intended for the browser and not DOMTemplate again.

Asides that then, yes, I can see the need for an extra method xml that would return the source straight, with no modifications, in case you wanted to load it back into a DOMTemplate.