I have had my struggle with the multi-node tree picker too. I needed it for content nodes. Here is my code, modified based on your inputs... (this code is for the multi-node tree picker's data saved as csv (not xml))
@{ string[] imagesString = Model.MiltiNodeTreePickerPropertyTypeAliasHere.Split(','); List images = new List(); } @foreach(string i in imagesString) { if (!images.Contains(i)) { images.Add(i); } } @foreach(var item in images) { var image = Library.MediaById(item); <img src="@image.umbracoFile" alt="@image.Name"/> }
Thats fair enough - I've a standard Umbraco Rss page (Customized to read only certain doc types) - by which I reads some info from - in that case I need to read an image path:
@{
//Change mime type umbraco.library.ChangeContentType("text/xml");
//Get the domain var siteURL = "http://" + Request.Url.Host;
//Get the news area node (only one of these per site) var newsAreaNode = Model.SideNormals.First();
//Get the latest createDate of all news items to use as the RSS feed updateDate var RSSFeedPubDate = newsAreaNode.Children.Where("articleDate <= DateTime.Now && Visible && umbracoNaviHide != true").OrderBy("UpdateDate desc").First();
Full image path from uComponents UcMultiNodeTreePicker
I'm trying so hard to extract the image path fron the first img. selected in UcMultiNodeTreePicker - with no further luck:
However I've a working example in xlst - but I have'nt managed to convert it to Razor - anyone know how...?
Maybe I should mention that I need to have the img path in this foreach loop:
@{
var newsAreaNode = Model.SideNormals.First();
}
@{
foreach (var item in newsAreaNode.Descendants().Where("NodetypeAlias == \"Artikel\""))
{
@*imgpath here*@
}
}
Hi Robin
I have had my struggle with the multi-node tree picker too. I needed it for content nodes. Here is my code, modified based on your inputs... (this code is for the multi-node tree picker's data saved as csv (not xml))
PS: Not tested...
Thank you Kasper - this looks promissing, however the img path NEEDs to be in this foreach loop:
foreach (var item in newsAreaNode.Descendants().Where("NodetypeAlias == \"Artikel\""))
{
@*imgpath here*@
}
Can I squize your example with all loops inside that...?
I think I need more information about your structure to help more. But the @image.umbracoFile is the image's path.
Thats fair enough - I've a standard Umbraco Rss page (Customized to read only certain doc types) - by which I reads some info from - in that case I need to read an image path:
@{
//Change mime type
umbraco.library.ChangeContentType("text/xml");
//Get the domain
var siteURL = "http://" + Request.Url.Host;
//Get the news area node (only one of these per site)
var newsAreaNode = Model.SideNormals.First();
//Get the latest createDate of all news items to use as the RSS feed updateDate
var RSSFeedPubDate = newsAreaNode.Children.Where("articleDate <= DateTime.Now && Visible && umbracoNaviHide != true").OrderBy("UpdateDate desc").First();
}
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:rssdatehelper="urn:rssdatehelper">
<channel>
<title>ANR News Feeds</title>
<link>@siteURL</link>
<pubDate>@RSSFeedPubDate.UpdateDate.ToString("r")</pubDate>
<generator>umbraco</generator>
<description>Add your description here</description>
<language>en</language>
@{
foreach (var item in newsAreaNode.Descendants().Where("NodetypeAlias == \"Artikel\""))
{
<item>
<img> @*ImagePath Here*@</img>
<title>@item.Name</title>
<link>@item.Url</link>
<pubDate>@item.UpdateDate.ToString("r")</pubDate>
<guid>@item.Url</guid>
<content:encoded><![CDATA[@item.bodyText]]></content:encoded>
</item>
}
}
</channel>
</rss>
I now managed to solve the issue by this foreach loop:
But thank you very much for your help... :-)
Okay. I think you may need to hardcode the root, then you can add the image path. Here is some new code:
Ha! We added answer at the same time :-)
Good you found a solution.
is working on a reply...