views:

21

answers:

1

Hey all,

I've had a question that I've been wondering for a while. I'm making a templating system for front-ends where tags are interpretted (like Smarty). I was wondering if there is value in having the tags be able to communicate with the HTML document and other "Smartyish" tags. I was hoping that the community would have some thoughts on this situation.

Benefits:

  • More power (tags can tell other tags how to look)
  • Better structure (smartyish tags behave and look just like html tags)
  • Tags can manipulate any element on the page

Drawbacks:

  • Tags can manipulate any element on the page
  • Tags can interfere with other tags
  • Code time will increase
+1  A: 

I think it would make the code much more complex and harder to analyse. Where the main aproach of template engines is to make code easier to understand.

It is not the aim templates to add much programming logic. These should be handled in the PHP script.

JochenJung
Thanks for taking the time to think out of the box, I had been thinking about it and you're completely right, it would make the code much more complex, and hard to figure out what tags are manipulating what. I do think tags could have the option to "retrieve" information about each other, but beyond that, the codebase will have too many dependencies.
Matt
I only partially agree with the second part though, I think that tags can have significant programming logic (like different renderings for different browsers), but it needs to be stashed behind the actual template tag in a library somewhere. Thanks again for your thoughts!
Matt