Rendering strings that reference variables

Hi,

I was wondering if there is a way to have a string stored in a database that contains “references” (I think the proper term is bindings?) to variables rendered after interpreting those references instead of as a string.

Assume the following:

  1. I have a page with a server connect sc1 that returns the a value called radius
  2. I have a variable call pi, that contains the value 3.14
  3. I have a paragraph that looks like this:

    Perimeter: {{sc1.data.radius * pi.value * 2}} cm

When the page is rendered, and ignoring any syntax error in my example and assuming that sc1 returns a radius of 10, the following will be shown:

Perimeter: 62.8 cm

Imagine that now I wanted to keep the text in 3 above in a database table, and that I have a server connect sc2 that retrieves the value of that string.

If I invoke sc2 and put the results on the page (something like sc2.data.stringtoshow, the page now shows the string as I saved it, i.e., without interpreting the values of the variables. It would look like

Perimeter: {{sc1.data.radius * pi.value * 2}} cm

I sort of understand why this happens but I’d like to know if there is a way of storing in a database table a string that contains references to variables, which can be later interpreted and rendered as the results of the reference and not as a string.

Many thanks,

Alex

Community Page
Last updated: