Copied to clipboard

Flag this post as spam?

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


  • Mike 18 posts 39 karma points
    May 18, 2015 @ 17:05
    Mike
    0

    How do I see the CurrentPage value?

    Hi. I'm new to Umbraco, building my first site. I have created a macro using LeBlender and that works fine. But now I want to try and add some code that references the CurrentPage.  I can see that the LeBlender Model doesn't support this, so do I need to add another @imports or @using declaration at the top of my partial?  Many thanks!

  • Antoine 176 posts 1494 karma points
    May 18, 2015 @ 19:02
    Antoine
    6

    Hi Mike, 

    The view have to inherit from UmbracoViewPage

    @inherits UmbracoViewPage<Lecoati.LeBlender.Extension.Models.LeBlenderModel>

    This way, you can access the Umbraco context and helper and the current content through the method:

    Umbraco.AssignedContentItem

    But this method works only in frontend. If you need a preview of your view within the backend, use the method we added into LeBlender helper which works in both backend and frontend:

    Lecoati.LeBlender.Extension.Helper.GetCurrentContent()

     

  • Mike 18 posts 39 karma points
    May 18, 2015 @ 22:43
    Mike
    0

    Hi Antione.  Thanks very much - I've got it working now.  Is there somewhere I can download details of all the LeBlender properties and methods?  The PDF that came with the install seems pretty short and there's not much to find via a standard web search.  Many thanks again for helping me!

  • Antoine 176 posts 1494 karma points
    May 19, 2015 @ 09:16
    Antoine
    2

    Hi Mike, the doc is short but really there isn't much more to know :)

    I just have to add some lines about the helper I mencioned before, but actually it has only two methods:

    GetCurrentContent() // get the current node (works in both frontend and backend)

    and

    IsFrontEnd() // return true if the current context is frontend

     

  • Mike 18 posts 39 karma points
    May 19, 2015 @ 09:33
    Mike
    0

    Hi Antione.  That's great - thanks for explaining it all to me!  I'm finding LeBlender really useful.  Thanks for all the hard work! :o)

  • Dan Sørensen 102 posts 327 karma points
    Sep 14, 2016 @ 10:58
    Dan Sørensen
    0

    This Lecoati.LeBlender.Extension.Helper.GetCurrentContent()

    Does not work if the node is unpublished, then what to do ?

  • Paul 184 posts 646 karma points
    May 03, 2017 @ 10:47
    Paul
    0
    IsFrontEnd() // return true if the current context is frontend
    

    Thanks for that Antoine! It's just helped me sort out an issue in the backoffice whereby adding certain css to a div I'm adding via LeBlender made the LeBlender un-editable, i.e. you could add it then set the CSS, but then not re-edit it.

    Gracias!

Please Sign in or register to post replies

Write your reply to:

Draft