Expand my Community achievements bar.

SOLVED

RTE- How to add dynamic values in between content

Avatar

Level 3

Hi All,

I have an requirement which need expertise suggetions to implement the same. The requirement is as follows

The Content which has to be added to the page has dynamic values like User ID's which fetch from other systems. if I use RTE can i able to do that. how to identify the dynamic values.

Example Content: "welcome to my company. you are shortlisted for the lucky draw. The user id allocated for you is XXXXX and agreement number is XXXXX"

Please let me know how to handle these kind of situations like editor has to update content where in between dynamic values will be present

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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.

See if any of the approach suits you.

- Runal

View solution in original post

3 Replies

Avatar

Level 3

Thanks for your reply shyam. Currently i am using Adobe CQ5.5 . Please suggest.

Avatar

Correct answer by
Community Advisor

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.

See if any of the approach suits you.

- Runal