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 510 posts 659 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 4908 posts 12265 karma points MVP 5x admin c-trib
    Feb 02, 2015 @ 12:13
    Jeroen Breuer
    0

    Hello,

    Can't you do the same in Umbraco 7?

    Jeroen

  • andrew shearer 510 posts 659 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

     

Please Sign in or register to post replies

Write your reply to:

Draft