No that combination is not allowed. It does not make any sense to combine those and as you have discovered it won't work :) Instead you should use proper razor syntax to fetch the values that you're trying to get by using umbraco:item (Which is an old syntax btw - In v7 it's @Umbraco.Field()).
So before making an example for you I would like to know if you just need to render the chosen images for each feature box?
Then you should be using the "TypedMedia" helper like @Umbraco.TypedMedia(page.GetPropertyValue("featureBox1Image")) - Then you can render the image into an image tag for each box. So something like this should do the trick.
@{
var imageBox1 = @Umbraco.TypedMedia(page.GetPropertyValue("featureBox1Image"))
}
<img src="@imageBox1.UmbracoFile" />
Since you are using the old dynamicNode Razor script, and I assume that you are using a media picker to choose the image. Then there is several options on how to get the image from the media picker.
Great that you got it to work. Happy that I could help you in the right direction. - Please remember to mark the question as solve, so other people can go directly to the solution that works for you.
Umbraco Item Tag in Razor Script?
I am using a Razor to render a macro with multiple <umbraco:Items>. Is this not allowed? What would be the proper way to do this? Here is my code:
Hi Steve
No that combination is not allowed. It does not make any sense to combine those and as you have discovered it won't work :) Instead you should use proper razor syntax to fetch the values that you're trying to get by using umbraco:item (Which is an old syntax btw - In v7 it's @Umbraco.Field()).
So before making an example for you I would like to know if you just need to render the chosen images for each feature box?
Then you should be using the "TypedMedia" helper like
@Umbraco.TypedMedia(page.GetPropertyValue("featureBox1Image"))
- Then you can render the image into an image tag for each box. So something like this should do the trick.I hope this helps.
/Jan
I have 3 feature boxes each with an image and content field and I am using Umbraco 6.1.6
Hi Steve,
Since you are using the old dynamicNode Razor script, and I assume that you are using a media picker to choose the image. Then there is several options on how to get the image from the media picker.
For the documentation take a look here: https://our.umbraco.org/documentation/Using-Umbraco/Backoffice-Overview/Property-Editors/Built-in-Property-Editors/Media-Picker#RazorMacro%28DynamicNode&DynamicMedia%29Example
Hope this helps,
/Dennis
Hi Steve
Ok, but then the approach I mentioned above should be possible to do. You just need to make 3 variables for getting the images.
Hope this helps.
/Jan
Dennis, what would the syntax look like for using imageGen on the <img> tags?
Hi Steve,
I think that you should be able to do something like this then.
Hope this helps,
/Dennis
Dennis, for some reason it's not using the width.
Got it :
<img src="/[email protected]&width=100" />
Hi Seve,
Okay perhaps you just can do this then.
Hope this helps,
/Dennis
Hi Steve,
Great that you got it to work. Happy that I could help you in the right direction. - Please remember to mark the question as solve, so other people can go directly to the solution that works for you.
/Dennis
What's wrong with my syntax on this if statement?
Hi Steve,
You can use the .HasValue to check if the field isn't empty.
Try this
Hope this helps,
/Dennis
Doesn't that just check to see if the property exists?
When I used that for the individual featureBox sections it renders even if there is nothing in the field.
Sorry Dennis, you are correct. Thanks again for all your help!!
Hi Steve.
The HasValue should check if the property contains a value. And HasProperty checks if the property exsist on the page.
But perhaps you could try something like this too.
Hope this helps,
/Dennis
is working on a reply...