Copied to clipboard

Flag this post as spam?

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


  • Mark Evans 86 posts 116 karma points
    Nov 18, 2014 @ 09:16
    Mark Evans
    0

    UmbracoApiController

    i created an apicontroller in order to allow umbraco content to be pulled from umbraco to another external non-umbraco site.

    The one issue i spotted in the content retrieved was that hyperlinks within the bodyText are set to retrieve a particular piece of content from umbraco but of course will not work out of the umbraco context.

    i.e.  

    <a href='/{localLink:1260}'

    As i know the page id being linked to, i am able to get the string within the { } and identify the id. I would then simply need to find the appropriate page within umbraco and grab the url property and do a replace on the umbraco link within the bodytext.

    However within the apicontroller the currentpage property is not available so i am not sure if i can locate what page equates to id 1260....

    is there a way around this? or an alternative way to achieve what im trying to do?

  • Stefan Kip 1614 posts 4131 karma points c-trib
    Nov 18, 2014 @ 09:28
    Stefan Kip
    0

    Use:

    umbraco.template.ParseInternalLinks(string text);
    
  • Mark Evans 86 posts 116 karma points
    Nov 18, 2014 @ 11:57
    Mark Evans
    0

    thanks

    that is deprecated but its successor, TemplateUtilities.ParseInternalLinks worked fine

     

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies