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
Hi guys, got this snippet ive put together:
@foreach(var item in selection){ if(item.HasValue("location") && @Model.Content.Id == @item.GetPropertyValue<int>("location")){ var singleLink = item.GetPropertyValue<Link>("links"); if(singleLink != null) { if(item.HasValue("wideImage")) { IPublishedContent mediaItem = item.GetPropertyValue<IPublishedContent>("wideImage"); <div class="owl-item" style="width: 891px;"><a href="@singleLink.Url" target="@singleLink.Target"><img class="tag-headadvert img-responsive" style="display: inline;" src="@mediaItem.Url" width="100%" alt="@singleLink.Name" /></a></div> } } }
In the second line you can see I make a comparison of the current page ID, vs a variable, is there a way to do, if that variable matches the current page ID, or any descendants of the current page ID?
Thanks
Something like this maybe:
var active = Model.Content.AncestorsOrSelf().Select(x => x.Id).ToArray().Contains(1020);
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
If X Matches Current Page ID, OR Any of Current Page's Descendants - is it possible?
Hi guys, got this snippet ive put together:
In the second line you can see I make a comparison of the current page ID, vs a variable, is there a way to do, if that variable matches the current page ID, or any descendants of the current page ID?
Thanks
Something like this maybe:
is working on a reply...