Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Feb 03, 2011 @ 18:12
    Jeroen Breuer
    0

    Replace all url's in content with XSLT extension

    Hello,

    I want to replace all the url's in the content. For example I want to change /nl/test into #!/nl/test. I wrote an XSLT extension for this, but the problem is that the interal url's are in a strange format. If I link to another page in the RTE the link is this: /{localLink:1100}. Somehow the link is displayed correct and if I look at the source it's changed into /nl/test. The problem is that the link won't be updated if I change the url. Here is a test XSLT extension:

    public static string ReplaceHtmlUrls(string html)
    {
        return html.Replace("/{localLink:1100}", "#!/{localLink:1100}");
    }

    Now the href attribute is changed into  '#!/{localLink:1100}', but it should be '#!/nl/test'. So it only works if I don't replace it... Any idea how to solve this?

    Jeroen

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Feb 03, 2011 @ 19:51
    Tom Fulton
    1

    Couldn't you parse out the ID portion, use NiceURL to get the URL and append it to "#!" ?

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Feb 03, 2011 @ 21:28
    Jeroen Breuer
    0

    Hi Tom,

    Thats a good alternative. Thanks! Offcourse it would be better if I could just add the #! to the /{localLink:1100} part so I wouldn't have to call the nice url method.

    Jeroen

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Feb 07, 2011 @ 11:54
    Jeroen Breuer
    0

    Anyone else got a good suggestion for this or should I just replace the url's manually?

    Jeroen

Please Sign in or register to post replies

Write your reply to:

Draft