I'm creating a program which helps to issue offer letters to candidates. Using summernote textarea I've stored the template in database table. But when displaying it shows simple html text instead of dynamic data.
I assume you are trying some sort of mailmerge?
Sorry but summernote cannot parse dynamic data in that way.
This node extension may help. I think there is also a php supported version on npm,seem to remember i did a php version for @sitestreet but not had any feedback from him.
Just add tags inside your summernote document. Basically exactly the same as what you were trying but use square brackets rather than braces i.e.
[ref_ol] not {{ref_ol}}
Obviosly the names in the tags must exactly match the field names you want the substitute in.
That's okay. But how to use it in correct way. I think I'm doing something wrong in implementation only. As provided screenshot structure, gives this error. {status: "500", message: "Cannot convert undefined or null to object",…} message : "Cannot convert undefined or null to object" stack : "TypeError: Cannot convert undefined or null to object\n at Function.keys (<anonymous>)\n at exports.documerge (D:\\applisis\\extensions\\server_connect\\modules\\documerge.js:7:28)\n at App._exec (D:\\applisis\\lib\\core\\app.js:722:49)\n at App._exec (D:\\applisis\\lib\\core\\app.js:689:20)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n at async App.exec (D:\\applisis\\lib\\core\\app.js:655:5)\n at async App.define (D:\\applisis\\lib\\core\\app.js:637:5)" status : "500"
OK, just to explain how it works so you understand what it is doing
You pass the text, normally of a summernote form input to the extension
That text can contain database field names encapsultated in square brackets. They must match EXACTLY the field name, incuding case
The document is parsed and each occurrent of [fieldname] within the text is substitued by the corresponding database field value
So if entering [fieldname], the module checks the json of your database input for a field of that name and substitues that value for the tag. it must be an EXACT match, including case
Difficult to tell as i dont know what the inputs are but, as you atre using summernote, i would expect your "Document" to be your Summernote input, something like $_POST.mydocument
The error suggests you have a fieldname in square brackets which does not have a matching database field or is empty.