Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I created a partial view macro... I am trying to get pictures from a media folder and loop through them to add to felx slider.... a complete copy almost of the gallery example.
Here is the code
@inherits Umbraco.Web.Macros.PartialViewMacroPage @{ if (Modal.HasValue("SlidePhotos")) { var MediaFolder = Library.MediaById(Modal.SlidePhotos); <div class="flexslider"> <ul class="slides"> @foreach (var photo in MediaFolder.childen) { <li> <img class="SlideImage" src="@photo.umbracoFile" /> </li> } </ul> </div> } }
The page that is calling tthe macro has a media picker called SlidePhotos. I am not sure what I have done wrong?
Thank you in advance
Hi Robert,
You have used the old legacy razor. When you´re using MVC the currentpage is not represented by Model. but by CurrentPage.
Try something like this instead.
@inherits Umbraco.Web.Macros.PartialViewMacroPage @{ if (CurrentPage.HasValue("SlidePhotos")){ var MediaFolder = Umbraco.Media(CurrentPage.SlidePhotos); <div class="flexslider"> <ul class="slides"> @foreach (var photo in MediaFolder.Childen){ <li> <img class="SlideImage" src="@photo.umbracoFile" alt="@photo.Name" /> </li> } </ul> </div> } }
You can find the documentation for the media picker here: http://our.umbraco.org/documentation/Using-Umbraco/Backoffice-Overview/Property-Editors/Built-in-Property-Editors/Media-Picker and if you are using version 7 the documentation is here: http://our.umbraco.org/documentation/using-umbraco/backoffice-overview/property-editors/Built-in-Property-Editors-v7/Media-Picker
Hope this helps,
/Dennis
is working on a reply...
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.
Continue discussion
Error loading partial view script
I created a partial view macro... I am trying to get pictures from a media folder and loop through them to add to felx slider.... a complete copy almost of the gallery example.
Here is the code
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@{
if (Modal.HasValue("SlidePhotos"))
{
var MediaFolder = Library.MediaById(Modal.SlidePhotos);
<div class="flexslider">
<ul class="slides">
@foreach (var photo in MediaFolder.childen)
{
<li>
<img class="SlideImage" src="@photo.umbracoFile" />
</li>
}
</ul>
</div>
}
}
The page that is calling tthe macro has a media picker called SlidePhotos. I am not sure what I have done wrong?
Thank you in advance
Hi Robert,
You have used the old legacy razor. When you´re using MVC the currentpage is not represented by Model. but by CurrentPage.
Try something like this instead.
You can find the documentation for the media picker here: http://our.umbraco.org/documentation/Using-Umbraco/Backoffice-Overview/Property-Editors/Built-in-Property-Editors/Media-Picker and if you are using version 7 the documentation is here: http://our.umbraco.org/documentation/using-umbraco/backoffice-overview/property-editors/Built-in-Property-Editors-v7/Media-Picker
Hope this helps,
/Dennis
is working on a reply...
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.