Over the years I have written a lot of code to assist with displaying information on our templates correctly.
One of functions that I use a lot in our scripts is a function called “DisplayTitleValuePair”.
So, when I for example call the function like:
displayTitleValuePair(
"orderno",
gTexts.orderno,
orderno,
results
).text();
the function will replace 2 placeholders in my template. The placeholders in this case are “txt_orderno” and “val_orderno”, where txt_orderno is the title of the item in the template (which comes from gTexts.orderno) and val_orderno will be replaced by the parameter orderno. The first parameter orderno determines which key/value pair needs to be replaced.
I use this function throughout all my templates/scripts.
I would like to switch wherever possible to handlebars as I like to use the latest technology and I feel it can really improve my template designs. In this case I am not sure whether handlebars are a good fit as I then need to replace a key/value pair with 2 handlebar expressions that somehow link back to a single custom helper.
And in the template I am replacing a Javascript function with basically the same Javascript function but then in the form of a custom helper.
Does handlebars in this case provide anything useful or would it only create additional overhead?