What I'm trying to do is return the URL of a contentpicker inside a media item. I've searched through the forum and seem to be using the various answers that are posted but getting an error...confused! I assume using umbraco.library.NiceUrl would work but no dice. Here's my script below if anyone point out what I'm doing wrong
@using DigibizAdvancedMediaPicker
@using umbraco.MacroEngines
@using umbraco.cms.businesslogic.member;
@using umbraco.cms.businesslogic.media;
@inherits umbraco.MacroEngines.DynamicNodeContext
@{
var promoBlocks = @Model.AncestorOrSelf(1).DescendantsOrSelf("HomepagePromoBlock");
@*promoBlocks.Count()*@
foreach (var promo in promoBlocks)
{
if (promo.HasAccess())
{
@*<p>@promo.Name</p>*@
if (promo.hotspots != null)
{
var mediaIds = promo.hotspots.Split(',');
foreach (string mId in mediaIds)
{
dynamic mediaItem = new DynamicMedia(Int32.Parse(mId));
dynamic hotspotImage = new DynamicMedia(Int32.Parse(@mediaItem.hotspotImage));
<a href="@umbraco.library.NiceUrl(mediaItem.hotspotLink)" title="@mediaItem.Name"><img src="@hotspotImage.umbracoFile" alt="image" /></a>
}
}
return;
}
}
}
Content Picker in media - Razor
What I'm trying to do is return the URL of a contentpicker inside a media item. I've searched through the forum and seem to be using the various answers that are posted but getting an error...confused! I assume using umbraco.library.NiceUrl would work but no dice. Here's my script below if anyone point out what I'm doing wrong
Just to add, I can return the node ID of the contentpicker without a problem but as soon as I try to add NiceUrl it errors
href="@mediaItem.hotspotLink ---> RETURNS: www.domain.com/1084
hotspotLink should be returning an ID of a node not a URL.
If it'snot then something is wrong, nothing to do with umbraco.library.NiceUrl, which expects an integer.
Are you using the standard in built Content Picker?
Rich
Ah yeh got it, now it works. This is what I did
Thanks,
Bij
is working on a reply...