I have a macro with a parameter using a custom rte. All works great when outputting the content, but if the user enters a link using the rte, then the output can contain something like this:
Not sure I understand what the issue is? Perhaps the mark down editor formatted your example into something else than you meant to display? I only see a "Click here" link, which refers to this post...perhaps a screendump would be easier to attach and make it more clear what the issue is?
Is it that you're not sure how you should render the link? Or does the link render weirdly?
Oh so the issue is that the href attribute get's the locallink stuff...not sure how you have done your implementation but perhaps some inspiration on how to deal with this can be found by having a look at the Umbraco source code? If I remember correctly there is a regex somewhere involved with getting the correct url...
I'm think that you should somehow be able to get the id in the locallink:1082 string and then use a method like NiceUrl (if it's called this these days) to give you the correct url...but that's of course only if it's a local/internal url and not an external url - Does this make sense?
Unfortunately I'm not a c# wizard myself so can't provide any code-samples :-/.
Outputting links from custom editor
Hi
I have a macro with a parameter using a custom rte. All works great when outputting the content, but if the user enters a link using the rte, then the output can contain something like this:
click here
The easy and right (!) way to handle this? At the moment I am outputting using the following:
@{ var text = Model.MacroParameters["text"]; } @Html.Raw(Server.HtmlDecode(text.ToString()))
Suggestions?
Hi Bo
Not sure I understand what the issue is? Perhaps the mark down editor formatted your example into something else than you meant to display? I only see a "Click here" link, which refers to this post...perhaps a screendump would be easier to attach and make it more clear what the issue is?
Is it that you're not sure how you should render the link? Or does the link render weirdly?
/Jan
Hi
Ah, didn't realize the forum editor parsed my stuff. Anyway, it outputs html and then this http://cl.ly/3v3U461g2q47
Hi Bo
Oh so the issue is that the href attribute get's the locallink stuff...not sure how you have done your implementation but perhaps some inspiration on how to deal with this can be found by having a look at the Umbraco source code? If I remember correctly there is a regex somewhere involved with getting the correct url...
I'm think that you should somehow be able to get the id in the locallink:1082 string and then use a method like NiceUrl (if it's called this these days) to give you the correct url...but that's of course only if it's a local/internal url and not an external url - Does this make sense?
Unfortunately I'm not a c# wizard myself so can't provide any code-samples :-/.
/Jan
is working on a reply...