Is there a way to review for the urls before rendering in umbraco?, and If the urls are internal and protected how can I add a class ?
I am using the richtext editor and I want to add a class = "pop" or something similar to all the urls that are portected for a determinate member, in the rendered page.
If you were looping through the pages via an XSLT macro, such as for navigation, this would be easy to achieve by using the XSLT Helper method umbraco.library:IsProtected and/or umbraco.library:HasAccess, but it seems like you're wanting to do this for links that might be inserted in a Richtext editor, correct?
In that case I think you're going to need to do some parsing of the RTE content before you render it -- parse all the links ({localLink:nodeId), run them through the helper method, and add the class if it returns true. Depending on if you're using XSLT or Razor one of these blogs might give you an idea of how to do that.
How to review for internal and protected links
Hello,
Is there a way to review for the urls before rendering in umbraco?, and If the urls are internal and protected how can I add a class ?
I am using the richtext editor and I want to add a class = "pop" or something similar to all the urls that are portected for a determinate member, in the rendered page.
I am using umbraco 4.5.2.
I am grateful for any suggestions.
Hi Jose,
If you were looping through the pages via an XSLT macro, such as for navigation, this would be easy to achieve by using the XSLT Helper method umbraco.library:IsProtected and/or umbraco.library:HasAccess, but it seems like you're wanting to do this for links that might be inserted in a Richtext editor, correct?
In that case I think you're going to need to do some parsing of the RTE content before you render it -- parse all the links ({localLink:nodeId), run them through the helper method, and add the class if it returns true. Depending on if you're using XSLT or Razor one of these blogs might give you an idea of how to do that.
- Transforming WYSIWYG output with XSLT [blog]
- Use the HtmlAgilityPack - example: Wrapping Images using the Html Agility Pack, TinyMce, Umbraco [blog]
Not the cleanest solution, I know, but should work - let us know if you have questions...
-Tom
Thanks Tom.
I appreciate your comment.
is working on a reply...