I came across this interesting templating tool, what the author calls as hQuery which is an 'Unobtrusive Server-side Scripting'. [More information here - https://github.com/choonkeat/hquery ]. It is built in Ruby for the RoR platform.
I wanted to know if something similar is available for other platforms (PHP, Python, Java)
PS : I know about templating engines like smarty and twig. I'm looking for something closer to hQuery.
I don't like using other templating engines much, really because I find them a little to heavyweight for anything I actually want to do (smarty for example).
There is a school of thinking that would say: PHP is already a templating engine... why build templates within templates?
I do disagree with this to an extent, I find templating very useful in abstracting HTML from PHP code.
Below is an edited method from my templating class that I use that will explain how easy it is to actually make yourself.
There is quite a bit more meat around this, but this is the core code. Read a file into an array, implode, search through the $params array and replace $field with $value in $html. Output the edited $html.
your index.html file will look something like:
Your output will be:
Maybe look at implementing your own templating engine! :)