How to display dynamic values from db stored as html

Hello everyone,

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.

This is what I tried.

On your page use dynamic attributes -> display -> inner html

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.

I've installed the extension but couldn't figure out how to use it correctly.


@Hyperbytes Please help.

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.

Sorry, also forgot. This acts on a record by record basis so if your query returns multiple records, you need to place it within a repeat.

I have taken a look at the extension which is pretty old and will be releasing an update later today (watch for version 1.0.1 on npm (or later)

Once released i will add a quick "how to" video

The extension has been updated and a "how to" video added to the original post