Copied to clipboard

Flag this post as spam?

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


  • andrew shearer 409 posts 517 karma points
    Feb 02, 2015 @ 05:47
    andrew shearer
    0

    umbraco context in 7

    hi

    in umbraco 6 we used the following code in custom routes to assume umbraco context of a given page. Does anyone have a concise/better example of how you're doing this in 7? thanks

    We have a class inheriting from UmbracoControl that would expose the following:

     

    protected void RenderUmbracoContent(IPublishedContent content)

    {

    var model = new RenderModel(content, CultureInfo.CurrentUICulture);

    //add an umbraco data token so the umbraco view engine executes

    RouteData.DataTokens["umbraco"] = model;

    HttpContext.Items["pageID"] = Convert.ToString(content.Id);

    }

  • Jeroen Breuer 4861 posts 12138 karma points MVP 3x admin c-trib
    Feb 02, 2015 @ 12:13
    Jeroen Breuer
    0

    Hello,

    Can't you do the same in Umbraco 7?

    Jeroen

  • andrew shearer 409 posts 517 karma points
    Feb 02, 2015 @ 21:14
    andrew shearer
    0

    Yes, Im using the same in 7, just thought there might be a better way now :D

    thanks

     

  • 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