I need to do token replacement inside grids on the Umbraco Razor page in 7.2.*, replacing special tokens out of the text stream with values I pull from a separate billing system. So for example [[DAY_COST]] would be replaced in the HTML with "$35.00 plus GST" or whatever that happened to be.
This talks about a similar problem but doesn't answer in a useful way for me:
I don't see how a "macro" would help, as the user can't I think insert a macro into the Rich Text editor.. .unless I'm missing something. Really it needs to be as easy as typing [[ReplaceMeWithAValue]].
I can work out how to "pipe" the output from the Razor View's file into some code which replaces the tokens with the values, but has anyone already done this, and what would be the neatest way to do it?
I know how to do everything except plumb this into Umbraco neatly; the question is not about parsing, regex, or database caching etc. It's about where precisely in Umbraco is the cleanest place to put some additional processing into the text content pipeline.
Token replacement in content
I need to do token replacement inside grids on the Umbraco Razor page in 7.2.*, replacing special tokens out of the text stream with values I pull from a separate billing system. So for example [[DAY_COST]] would be replaced in the HTML with "$35.00 plus GST" or whatever that happened to be.
This talks about a similar problem but doesn't answer in a useful way for me:
https://our.umbraco.org/forum/using/ui-questions/40886-Token-replacement-is-pages-How
I don't see how a "macro" would help, as the user can't I think insert a macro into the Rich Text editor.. .unless I'm missing something. Really it needs to be as easy as typing [[ReplaceMeWithAValue]].
I can work out how to "pipe" the output from the Razor View's file into some code which replaces the tokens with the values, but has anyone already done this, and what would be the neatest way to do it?
I know how to do everything except plumb this into Umbraco neatly; the question is not about parsing, regex, or database caching etc. It's about where precisely in Umbraco is the cleanest place to put some additional processing into the text content pipeline.
Hi Philw,
I have done such the things like below
Hope this is usefull
Regards,
Mehul Gajjar.
I think that is probably precisely what I need to know, although it may take me a few days to get time to test it.
In eg Bootstrap3.cshtml there's a @Html.Partial bit, which I looks like the place I need to be.
So I think you're saying that the @Html.Partial returns plain text (or HTML), so I can pipe that into my parsing stuff.
I'll report back. Thanks!
I've had to do something similar, may not be the best approach granted but it works fine and you can just do:
Thanks, Dave
I just did that and it works as advertised - ta!
I will try the other option in due course.
is working on a reply...