Hello all,
I saw on YouTube agentzh's NGinx conf 2014 talk about OpenResty and was smitten. Since then I've been thinking through how to replace our PHP app w/ OpenResty. I've already mapped out how most (80%) of our PHP will translate to OpenResty but I'm unsure about how to approach the HTML. Specifically, I would like some guidance on what is the best (i.e., efficient and maintainable) method to compose and/or manage HTML responses (20%).
I'm not new to programming. I've got history and there are couple things from old that I would like not to repeat:
1. Composition via string concatenation of massive chunks of markup. The problem is the HTML and the Lua code become too tightly coupled so suddenly the markup is outside the reach and understanding of our web designers. This is a maintainability nightmare.
2. Templating languages. I'm not refusing to use a templating language but I am concerned about their efficiency. Templating languages carry overhead because the markup gets parsed twice. Once by the runtime (e.g., constructing string objects) and the second time by the templating engine as it consumes the string objects to scan the markup to find/replace the template variables. Now you may be thinking, "but PHP is a templating langue", and you are right. But they solved the double parsing problem by making the templating engine and the runtime one and the same. Granted, they did a horrific job in terms of memory utilization and performance, but conceptually, they nailed it.
Please note, if a templating language is the only reasonable solution that I would appreciate a reference to a low overhead templating solution.
Thanks,
-rez