This is a snippet for a document type where I pick an image for an article. The issue right now is that the document property currently is an "upload", but I want it to be a "media picker".
I positive that I need to use Umbraco.Media, but being too new to MVC, I'm stuck. :/
Thanks alot. Yes, the "image" is the alias for the "Upload" property. I'll just reuse it with "Media Picker".
I oversaw one snippet, which is also in the legacy scripting language.
@inherits umbraco.MacroEngines.DynamicNodeContext
@* Ensure that the Current Page has children, where the property umbracoNaviHide is not True *@
@if (Model.Children.Where("Visible").Any())
{
<div class="article_images">
@* For each child page under the root node, where the property umbracoNaviHide is not True *@
@foreach (var childPage in Model.Children.Where("Visible"))
{
<a href="@childPage.image" class="article_image" rel="shadowbox[gallery]">
<img src="/[email protected]&width=100" style="border: 0;" /></a>
}
</div>
}
What that snippet does, is to take all the published images added under the article node and show them.
I tried converting the code, but I'm getting an runetime error. Here's is the code I tried:
Converting to MVC
Hello,
is anyone able to translate this snippet to MVC / PartialView?
This is a snippet for a document type where I pick an image for an article. The issue right now is that the document property currently is an "upload", but I want it to be a "media picker".
I positive that I need to use Umbraco.Media, but being too new to MVC, I'm stuck. :/
Hi Annfinn,
Is this to be a Partial View Macro for the Parameter?
Jeavon
Yes it is. Hello again, btw :) hehe
Hello! :-) I think this should do it:
I'm not sure about the "image" property, is that your "Upload" property alias?
Hello,
Thanks alot. Yes, the "image" is the alias for the "Upload" property. I'll just reuse it with "Media Picker".
I oversaw one snippet, which is also in the legacy scripting language.
What that snippet does, is to take all the published images added under the article node and show them.
I tried converting the code, but I'm getting an runetime error. Here's is the code I tried:
To get the idea, you can visit http://www.fiskimannafelag.fo/savn/tidindi/skiparin-ov-litid-at-siga.aspx and scroll all the way down to the 3 pictures. The snippet make those 3 pictures appear. :)
I think your only issue is that you have "childpage" and "childPage"
is working on a reply...