Approach 1:

RTE has got a plugin called InsertVariablePlugin, it pretty much does the same, inserts the dynamic values in RTE content.

2 OOTB RTE configuration examples you can refer to:

  1. /libs/mcm/components/newsletter/footer/dialog/items/text/rtePlugins/insertvariable/variables
    • It is newsletter text component.
  2. /libs/mcm/components/newsletter/footer/dialog/items/text/rtePlugins/insertvariable/variables/givenName
    • It is newsletter footer component.

More on InsertVariablePlugin can be found on widget API page - http://dev.day.com/docs/en/cq/current/widgets-api/index.html

But I guess they refer dynamic values only from logged in users profile so you might need to extend it.

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Approach 2:

  • We had similar requirement but we did not want to extend InsertVariablePlugin to inject dynamic values. So what we did; while defining content of RTE we inserted dynamic text with placeholders like - $$Dynamic_Val_1$$
  • Before rendering the RTE content, we wrote the wrapper function to rewrite the dynamic values with the actual content we need. Basic String replace in java function.

Approach 2 is more or less same as what Justin has suggested.

See if any of the approach suits you.

- Runal