Hi guys, 
We're using a Blossom controller in Magnolia 4.5 with stk to render a component 
in a custom maven module.

We want the Authors to be able enter a rich text (Fckedit) with placeholders .. 
something like:
[i]Hi, your name is #(name), your phone number is #(Phone), and you can change 
your profile with this [b]LINK[/b]. bye bye.[/i]

then the text will be rendered with all the placeholders substituted with the 
correct values taken from a (db/web service/whatever). 


So:
The author saves the text with dialogs.
We are getting the Nodes in the controller with Blossom:

[code]
@Template(id = "magnolia-assimoco-module:components/myPlaceholder", title = 
"PlaceholderText", dialog = "placeholderDialog")
@I18nBasename("info.magnolia.module.my-magnolia-module.messages")
@Controller
public class MyPlaceholderComponent  extends AbstractServiceCaller {


@RequestMapping("/textWithPlaceholders")
public String handle(Model model, ...request... , ...response ... , Node node, 
[b]Node content[/b]) throws ... {
... // load from services, db, beans etc... 

...
Property property= content.getProperty(propName);
String message = property.getValue().getString();
String myMessage = substitutePlaceholders(message);
model.addAttribute("mymessage",myMessage);
...
}[/code]

then we're substituting the placeholders in the text with java regexp with the 
correct user's values.
and we're printing then the final message in FTL with a simple ${myMessage!''}

But: 
If an author places a static link in the text to another page of the site, the 
links will not be parsed (ah href="${link: bla blah blah: }" is generated) 

So the real questions:
 . Is there a simpler way to do it?  
 . Can I inject in Blossom the TemplateFunctions so i can use decode() on the 
node before the substitutions, like as using ${cmsfn.decode(content).mymessage} 
 in FTL?  HOW? 
 . Or otherwise how can i use the cmsfn.decode() in FTL with a provided String?
 
Thank you for any advice!
Max

-- 
Context is everything: 
http://forum.magnolia-cms.com/forum/thread.html?threadId=c5a272b1-7da0-4d22-98d1-6e24611400f0


----------------------------------------------------------------
For list details, see http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to