Copied to clipboard

Flag this post as spam?

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


  • Glen Foster 3 posts 23 karma points
    Jun 24, 2013 @ 18:07
    Glen Foster
    0

    Accessing DAMP images with Razor

    Hi,

    I feel like I'm going down completely the wrong track, please could someone point me in the right direction! I have a page with a carousel of images and links which I'm trying to iterate through and display the image and link. I've added the following bits at the top:

    @using umbraco.NodeFactory
    @using DigibizAdvancedMediaPicker

    I can only seem to get the carousel items hardcoding the ID of the page:

        var banners = uQuery.GetNode(1064);

    and then I'm looping through them like this:

        @foreach (Node node in banners.Children)
        {
        }

    Inside the loop I've tried a number of things but can't get anything to work. I have an image crop called "Homepage Banner" which I'm trying to access. I think the problem starts with the fact I'm using nodes but I couldn't get anything else to work! Any ideas?

    Thanks,

    Glen

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Jun 24, 2013 @ 19:33
    Jeavon Leopold
    0

    Hi Glen and welcome to Our Umbraco!

    Two quick questions for you, what version of Umbraco are you using and are you using Webforms (.master) or Mvc (.cshtml) templates?

    Thanks,

    Jeavon

  • Jeroen Breuer 4909 posts 12266 karma points MVP 5x admin c-trib
    Jun 24, 2013 @ 20:10
    Jeroen Breuer
    0

    Hello,

    Did you try some of these examples which could help?

    DAMP 2.5 Samples - Video: http://www.screenr.com/gz0s

    DAMP Gallery - Video: http://www.screenr.com/1Vx7

    Jeroen

  • Glen Foster 3 posts 23 karma points
    Jun 25, 2013 @ 10:38
    Glen Foster
    0

    Hi everyone, thanks for the quick replies! I'm using version 6.0.6 with cshtml files (like every good developer I decided to use the newest code with the least documentation :))

    I've just tried accessing CurrentPage but the object doesn't exist - is this because I'm using umbraco.NodeFactory?

    Thanks,

    Glen

  • Jeroen Breuer 4909 posts 12266 karma points MVP 5x admin c-trib
    Jun 25, 2013 @ 12:13
    Jeroen Breuer
    0

    In Umbraco there are 2 versions of cshtml files. What version are you using? Have a look here for more info: 

    http://our.umbraco.org/projects/backoffice-extensions/digibiz-advanced-media-picker/digibiz-advanced-media-picker/39627-How-to-detect-if-no-items-have-been-picked?p=0#comment144735

    If your code starts with @inherits Umbraco.Web.Mvc.UmbracoTemplatePage you can use CurrentPage.

    This blog might also help: http://umbraco.com/follow-us/blog-archive/2012/10/30/getting-started-with-mvc-in-umbraco-410.aspx

    Jeroen

  • 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