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:
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?
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?
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
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
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
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
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
is working on a reply...